@import url('font.css');

:root {
    --bg-canvas: #F8F5F0;
    --bg-surface: #FFFFFF;
    --bg-subtle: #FAF6F0;
    --bg-input: #FCFAF7;
    --header-bg: #281A10;
    --header-surface: #3A2719;
    --header-hover: #4C3322;
    --border-header: rgba(166, 117, 67, 0.3);
    --border-card: #EADFCF;
    --border-input: #E2D6C5;
    --border-subtle: #EFE7DC;
    --primary: #8C5A32;
    --primary-hover: #784C29;
    --primary-active: #684021;
    --accent-gold: #D4A373;
    --accent-amber: #C6923A;
    --accent-badge: #A76938;
    --text-main: #2D1F16;
    --text-muted: #7A6657;
    --text-secondary: #5E4939;
    --text-light: #FAF3EA;
    --danger: #B3261E;
    --danger-bg: #FDF2F0;
    --danger-border: #F5C7C2;
    --success: #246337;
    --success-bg: #E6F4EA;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(40, 26, 16, 0.05);
    --shadow-md: 0 4px 14px rgba(40, 26, 16, 0.08);
    --shadow-lg: 0 10px 25px rgba(40, 26, 16, 0.12);
}

* {
    box-sizing: border-box;
}

body { 
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background-color: var(--bg-canvas); 
    color: var(--text-main);
    margin: 0; 
    padding: 0; 
    min-height: 100vh;
    display: none; /* تا زمانی که وضعیت لاگین چک نشده، صفحه مخفی است */
    -webkit-tap-highlight-color: transparent;
}

/* هدر لوکس مدیران درب */
.header { 
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: var(--header-bg); 
    color: var(--text-light); 
    padding: 12px 24px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-header);
    box-shadow: 0 4px 18px rgba(28, 18, 11, 0.25);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 { 
    margin: 0; 
    font-size: 16px; 
    font-weight: 800;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-gold);
    background: #3E2A1B;
    border: 1px solid rgba(92, 62, 40, 0.6);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: monospace;
    letter-spacing: 0.5px;
}

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold);
    display: inline-block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-btn { 
    color: #ffd2d2; 
    text-decoration: none; 
    background: rgba(179, 38, 30, 0.2); 
    border: 1px solid rgba(179, 38, 30, 0.4);
    padding: 7px 14px; 
    border-radius: var(--radius-md); 
    font-size: 12px; 
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.logout-btn:hover { 
    background: var(--danger); 
    color: white;
}

.container { 
    padding: 28px 20px 60px; 
    max-width: 1200px;
    margin: 0 auto;
}

/* کارت خوش‌آمدگویی */
.welcome-box { 
    background: var(--bg-surface); 
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl); 
    padding: 26px 30px; 
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.welcome-box::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-gold), var(--primary));
}

.welcome-box h2 {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
}

.welcome-box p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
}

/* شبکه ماژول‌ها */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.module-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-gold);
}

.module-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 16px;
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.module-card:hover .module-icon {
    transform: scale(1.08);
    background: #FAECDC;
    color: #854B1B;
}

.module-card h3 {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 800;
}

.module-card p {
    margin: 0 0 16px 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    flex: 1;
}

.module-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

.module-card:hover .module-footer {
    color: var(--primary-hover);
}

.admin-only {
    display: none;
}

/* Slide Menu & Drawer */
.menu-btn { 
    background: var(--header-surface); 
    border: 1px solid rgba(88, 60, 39, 0.6); 
    color: var(--text-light); 
    cursor: pointer; 
    padding: 8px 10px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    background: var(--header-hover);
    color: white;
}

.side-menu { 
    position: fixed; 
    top: 0; 
    right: -360px; 
    width: clamp(270px, 84vw, 320px); 
    max-width: 88vw;
    height: 100vh; 
    height: 100dvh; 
    max-height: 100dvh;
    background-color: var(--header-bg); 
    color: var(--text-light); 
    box-shadow: -6px 0 25px rgba(28, 18, 11, 0.5); 
    transition: right 0.32s cubic-bezier(0.16, 1, 0.3, 1); 
    z-index: 1000; 
    padding: clamp(14px, 3.5vw, 22px); 
    box-sizing: border-box; 
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-header);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(166, 117, 67, 0.4) transparent;
}

.side-menu::-webkit-scrollbar {
    width: 5px;
}
.side-menu::-webkit-scrollbar-track {
    background: transparent;
}
.side-menu::-webkit-scrollbar-thumb {
    background: rgba(166, 117, 67, 0.4);
    border-radius: 4px;
}
.side-menu::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

.side-menu.open { 
    right: 0; 
}

.menu-close { 
    font-size: clamp(22px, 5.5vw, 26px); 
    color: var(--accent-gold); 
    text-decoration: none; 
    cursor: pointer; 
    line-height: 1; 
    align-self: flex-start;
    padding: clamp(4px, 1.2vw, 8px);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.menu-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.profile-section { 
    text-align: center; 
    margin-top: clamp(4px, 1.2vh, 10px); 
    margin-bottom: clamp(12px, 2.2vh, 20px); 
    border-bottom: 1px solid rgba(166, 117, 67, 0.2); 
    padding-bottom: clamp(10px, 2vh, 18px); 
    flex-shrink: 0;
}

.profile-avatar { 
    width: clamp(52px, 13vw, 72px) !important; 
    height: clamp(52px, 13vw, 72px) !important; 
    aspect-ratio: 1 / 1; 
    border-radius: 50%; 
    margin-bottom: clamp(6px, 1.5vh, 10px); 
    object-fit: cover; 
    border: 2.5px solid var(--accent-gold); 
    background: white; 
    box-shadow: 0 0 15px rgba(212, 163, 115, 0.25);
}

.profile-section h3 {
    margin: 0 0 clamp(4px, 0.8vh, 6px) 0; 
    font-size: clamp(0.88rem, 2.5vw, 1rem);
    font-weight: 800;
    color: var(--text-light);
}

.profile-role-badge {
    display: inline-block;
    background: #3E2A1B;
    color: var(--accent-gold);
    border: 1px solid rgba(92, 62, 40, 0.6);
    padding: clamp(2px, 0.5vh, 4px) clamp(8px, 2vw, 12px);
    border-radius: 12px;
    font-size: clamp(0.7rem, 2vw, 0.78rem);
    font-weight: 600;
}

.side-menu a.menu-link { 
    display: flex; 
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    color: #D6C2B0; 
    text-decoration: none; 
    padding: clamp(0.5rem, 1.4vh, 0.7rem) clamp(0.7rem, 2vw, 0.95rem); 
    font-size: clamp(0.82rem, 1.9vw, 0.88rem); 
    font-weight: 600;
    transition: all 0.2s; 
    border-radius: var(--radius-md); 
    margin-bottom: clamp(3px, 0.7vh, 5px); 
    min-height: clamp(38px, 5vh, 44px);
    box-sizing: border-box;
    flex-shrink: 0;
}

.side-menu a.menu-link svg {
    width: clamp(16px, 3.8vw, 18px);
    height: clamp(16px, 3.8vw, 18px);
    flex-shrink: 0;
}

.side-menu a.menu-link:hover { 
    color: white; 
    background: var(--header-surface); 
    border-right: 3px solid var(--accent-gold);
}

.side-menu a.menu-link.menu-sublink {
    padding-right: clamp(22px, 5.5vw, 32px) !important;
    font-size: clamp(0.76rem, 1.8vw, 0.82rem) !important;
    min-height: clamp(34px, 4.4vh, 38px);
    margin-bottom: 2px;
    opacity: 0.92;
}

.side-menu a.menu-link.logout-link {
    margin-top: clamp(14px, 2.5vh, 22px);
    margin-bottom: clamp(16px, 3.5vh, 28px);
    color: #F8B4B4;
    background: rgba(179, 38, 30, 0.15);
    border: 1px solid rgba(179, 38, 30, 0.3);
    flex-shrink: 0;
}

.side-menu a.menu-link.logout-link:hover { 
    background: var(--danger); 
    color: white; 
}

@media (max-height: 680px) {
    .side-menu {
        padding: 10px 12px;
    }
    .profile-section {
        margin-top: 2px;
        margin-bottom: 8px;
        padding-bottom: 8px;
    }
    .profile-avatar {
        width: 44px !important;
        height: 44px !important;
        margin-bottom: 4px;
    }
    .profile-section h3 {
        font-size: 0.84rem;
        margin-bottom: 2px;
    }
    .profile-role-badge {
        font-size: 0.68rem;
        padding: 1px 6px;
    }
    .side-menu a.menu-link {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-height: 34px;
        margin-bottom: 2px;
    }
    .side-menu a.menu-link.menu-sublink {
        padding-right: 20px !important;
        font-size: 0.74rem !important;
        min-height: 30px;
    }
}

.overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    background: rgba(28, 18, 11, 0.6); 
    backdrop-filter: blur(4px);
    z-index: 999; 
    display: none; 
    transition: opacity 0.3s;
}

.overlay.show { 
    display: block; 
}

/* =========================================================================
   قوانین واکنش‌گرایی هدر و مخفی‌سازی بج‌های انگلیسی در حالت موبایل
   ========================================================================= */
@media (max-width: 768px) {
    .header { 
        padding: 10px 14px; 
        gap: 8px;
    }

    .header-brand {
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .header h1 { 
        font-size: 14px; 
        gap: 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* حذف نام انگلیسی بخش‌ها در حالت ریسپانسیو جهت باز شدن فضا */
    .brand-badge {
        display: none !important;
    }

    .brand-dot {
        width: 7px;
        height: 7px;
        flex-shrink: 0;
    }

    .user-info {
        gap: 6px;
        flex-shrink: 0;
    }

    .my-card-header-btn {
        padding: 6px 10px;
        font-size: 11.5px;
        gap: 5px;
        white-space: nowrap;
    }

    .logout-btn {
        padding: 6px 10px;
        font-size: 11.5px;
        gap: 5px;
        white-space: nowrap;
    }

    .header .btn-add-member {
        padding: 6px 10px;
        font-size: 11.5px;
        gap: 4px;
        white-space: nowrap;
        width: auto;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }

    .header-brand {
        gap: 6px;
    }

    .header-brand .menu-btn {
        padding: 6px;
        border-radius: 8px;
    }

    .header-brand .menu-btn svg {
        width: 18px;
        height: 18px;
    }

    .header h1 {
        font-size: 12.5px;
    }

    .user-info {
        gap: 4px;
    }

    .my-card-header-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .logout-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .header .btn-add-member {
        padding: 5px 8px;
        font-size: 11px;
    }

    .my-card-header-btn svg,
    .logout-btn svg,
    .header .btn-add-member svg {
        width: 13px;
        height: 13px;
    }
}

@media (max-width: 380px) {
    .header h1 {
        font-size: 12px;
    }
    
    .my-card-header-btn span {
        display: none;
    }
    
    .logout-btn span {
        display: none;
    }
    
    .my-card-header-btn,
    .logout-btn {
        padding: 6px 8px;
    }
}

