/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    background-color: #101922;
    color: white;
}

/* Header */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: rgba(16, 25, 34, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #1e293b;
}

.portal-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.portal-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #137fec;
    border-radius: 0.5rem;
}

.portal-logo svg {
    color: white;
    width: 1.5rem;
    height: 1.5rem;
}

.portal-title {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 1rem;
}

.portal-user-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portal-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    overflow: hidden;
    border: 2px solid #324d67;
    cursor: pointer;
    transition: border-color 0.2s;
    background: none;
    padding: 0;
}

.portal-user-avatar:hover {
    border-color: #137fec;
}

.portal-user-avatar img,
.portal-user-avatar svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Main Content */
.portal-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Search */
.portal-search-container {
    margin-bottom: 2rem;
}

.portal-search-wrapper {
    display: block;
    width: 100%;
}

.portal-search-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.portal-search-icon {
    position: absolute;
    right: 1rem;
    color: #92adc9;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.portal-search-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.portal-search-input {
    width: 100%;
    height: 3.5rem;
    padding: 0 3rem 0 1rem;
    background-color: #1e2a37;
    border: 1px solid #324d67;
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    text-align: right;
    direction: rtl;
}

.portal-search-input:focus {
    outline: none;
    border-color: #137fec;
    box-shadow: 0 0 0 2px rgba(19, 127, 236, 0.2);
}

.portal-search-input::placeholder {
    color: #92adc9;
}

/* Categories */
.portal-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.portal-categories::-webkit-scrollbar {
    height: 4px;
}

.portal-categories::-webkit-scrollbar-track {
    background: transparent;
}

.portal-categories::-webkit-scrollbar-thumb {
    background: #324d67;
    border-radius: 2px;
}

.category-button {
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: 1px solid #324d67;
    border-radius: 0.5rem;
    color: #92adc9;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: 'Vazirmatn', sans-serif;
}

.category-button:hover {
    background-color: rgba(19, 127, 236, 0.1);
    border-color: #137fec;
    color: #137fec;
}

.category-button.active {
    background-color: #137fec;
    border-color: #137fec;
    color: white;
}

.category-button p {
    margin: 0;
}

/* Section Header */
.portal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.portal-section-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

.portal-recent-link {
    font-size: 0.875rem;
    color: #137fec;
    cursor: pointer;
    transition: color 0.2s;
}

.portal-recent-link:hover {
    color: rgba(19, 127, 236, 0.8);
}

/* Tools Grid */
.portal-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.tool-card {
    background-color: #1e2a37;
    border: 1px solid #324d67;
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    border-color: #137fec;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(19, 127, 236, 0.2);
}

.tool-card:active {
    transform: scale(0.98);
}

/* Notice */
.portal-notice {
    background-color: rgba(19, 127, 236, 0.1);
    border: 1px solid rgba(19, 127, 236, 0.3);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 2rem;
}

.portal-notice-content {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.portal-notice-content svg {
    color: #137fec;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.portal-notice-title {
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.portal-notice-text {
    font-size: 0.875rem;
    color: #92adc9;
    line-height: 1.5;
}

/* Footer */
.portal-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(16, 25, 34, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid #1e293b;
    z-index: 50;
}

.portal-footer-content {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
}

.portal-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #92adc9;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.5rem 1rem;
}

.portal-footer-item:hover {
    color: #137fec;
}

.portal-footer-item.active {
    color: #137fec;
}

.portal-footer-item svg {
    width: 1.5rem;
    height: 1.5rem;
}

.portal-footer-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.portal-footer-indicator {
    display: flex;
    justify-content: center;
    padding-bottom: 0.5rem;
}

.portal-footer-bar {
    width: 8rem;
    height: 0.25rem;
    background-color: #324d67;
    border-radius: 9999px;
}

/* Responsive */
@media (min-width: 768px) {
    .portal-header-content {
        max-width: 1200px;
    }
    
    .portal-tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .portal-footer {
        display: none;
    }
}

@media (min-width: 1024px) {
    .portal-tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1280px) {
    .portal-tools-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}


/* Tool Card Semantic Classes */
.tool-card {
    background-color: #1e2a37;
    border: 1px solid #324d67;
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    text-align: right;
}

.tool-card:hover {
    border-color: #137fec;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(19, 127, 236, 0.2);
}

.tool-card:active {
    transform: scale(0.98);
}

.tool-card-icon-wrapper {
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    align-self: flex-start;
}

.tool-card-icon-svg {
    width: 2rem;
    height: 2rem;
}

.tool-icon-orange {
    background-color: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.tool-icon-blue {
    background-color: rgba(37, 99, 235, 0.2);
    color: #2563eb;
}

.tool-icon-emerald {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.tool-icon-indigo {
    background-color: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

.tool-icon-rose {
    background-color: rgba(244, 63, 94, 0.2);
    color: #f43f5e;
}

.tool-icon-cyan {
    background-color: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
}

.tool-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.tool-card-title {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.tool-card-description {
    color: #92adc9;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.tool-card-action {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #137fec;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-card-action-text {
    flex: 1;
}

.tool-card-action-icon {
    width: 1rem;
    height: 1rem;
    transform: scaleX(-1);
}

.tools-empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #92adc9;
    font-size: 1rem;
}

/* User Popup */
.user-popup {
    position: fixed;
    top: 4.5rem;
    left: 1.5rem;
    background-color: #1e2a37;
    border: 1px solid #324d67;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    min-width: 16rem;
    animation: popupFadeIn 0.2s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-popup-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.user-popup-header svg {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    border: 2px solid #324d67;
}

.user-popup-info {
    flex: 1;
}

.user-popup-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.25rem 0;
}

.user-popup-role {
    font-size: 0.75rem;
    color: #92adc9;
    margin: 0;
}

.user-popup-divider {
    height: 1px;
    background-color: #324d67;
    margin: 0 0.5rem;
}

.user-popup-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: #f43f5e;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: right;
    border-radius: 0 0 0.75rem 0.75rem;
}

.user-popup-logout:hover {
    background-color: rgba(244, 63, 94, 0.1);
}

.user-popup-logout svg {
    flex-shrink: 0;
}
