/* ============================================ */
/* ========== RESET & BASE ========== */
/* ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #00BFA6;
    --primary-dark: #009688;
    --primary-light: #00BFA615;
    --primary-gradient: linear-gradient(135deg, #00BFA6, #009688);
    --bg-start: #e8f5f0;
    --bg-end: #d5e8e3;
    --bg: #f0f2f5;
    --bg-secondary: #e8edf2;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========== DARK MODE ========== */
html.dark-mode {
    --bg-start: #0a0a12;
    --bg-end: #12121e;
    --bg: #0a0a0f;
    --bg-secondary: #14141a;
    --surface: #1a1a24;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Pinar', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: var(--transition);
    position: relative;
}

/* ============================================ */
/* ========== پس‌زمینه دکوراتیو ========== */
/* ============================================ */

.bg-decoration {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blobFloat 20s ease-in-out infinite;
}

.bg-blob-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    background: radial-gradient(circle, #00BFA6, transparent 70%);
    animation-delay: 0s;
}

.bg-blob-2 {
    width: 350px;
    height: 350px;
    bottom: -50px;
    left: -80px;
    background: radial-gradient(circle, #4A90E2, transparent 70%);
    animation-delay: -5s;
    opacity: 0.3;
}

.bg-blob-3 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, #9B59B6, transparent 70%);
    animation-delay: -10s;
    opacity: 0.15;
}

.bg-blob-4 {
    width: 250px;
    height: 250px;
    bottom: 30%;
    right: -50px;
    background: radial-gradient(circle, #F5A623, transparent 70%);
    animation-delay: -15s;
    opacity: 0.2;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(40px, 20px) scale(1.02); }
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 191, 166, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 191, 166, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 60s linear infinite;
}

html.dark-mode .bg-grid {
    background-image: 
        linear-gradient(rgba(0, 191, 166, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 191, 166, 0.05) 1px, transparent 1px);
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* ============================================ */
/* ========== APP MOBILE ========== */
/* ============================================ */

.app-mobile {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px 80px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

/* ============================================ */
/* ========== HEADER GLASS ========== */
/* ============================================ */

.header-glass {
    position: sticky;
    top: 12px;
    z-index: 100;
    margin: 12px 0 8px;
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
    flex-shrink: 0;
}

html.dark-mode .header-glass {
    background: rgba(20, 20, 26, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
}

.header-glass-bg {
    position: absolute;
    top: -60%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--primary-light), transparent 70%);
    border-radius: 50%;
    opacity: 0.5;
    pointer-events: none;
}

.header-glass-content {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-glass {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-glass-text {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.logo-glass-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.logo-glass-sub {
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    opacity: 0.7;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.glass-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: var(--text-secondary);
    padding: 0;
}

html.dark-mode .glass-btn {
    background: rgba(255, 255, 255, 0.06);
}

.glass-btn:active {
    transform: scale(0.92);
}

.glass-btn svg {
    width: 18px;
    height: 18px;
}

.theme-btn {
    background: rgba(0, 0, 0, 0.04);
}

html.dark-mode .theme-btn {
    background: rgba(255, 255, 255, 0.08);
}

.theme-icon {
    transition: all 0.3s ease;
}

.user-btn {
    background: var(--primary-gradient);
    color: white;
    font-weight: 700;
    font-size: 0.65rem;
    width: 34px;
    height: 34px;
}

.user-avatar-glass {
    font-size: 0.65rem;
    font-weight: 700;
}

/* ============================================ */
/* ========== MAIN CONTENT ========== */
/* ============================================ */

.main-mobile {
    flex: 1;
    padding: 8px 0 20px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
    scroll-behavior: smooth;
}

.main-mobile::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    background: transparent;
}

.main-mobile {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.content-header {
    padding: 8px 4px 14px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.content-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.add-category-btn {
    padding: 8px 16px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Pinar', sans-serif;
}

.add-category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 191, 166, 0.3);
}

/* ============================================ */
/* ========== کارت‌ها ========== */
/* ============================================ */

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-bottom: 8px;
}

.card-minimal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: fadeUp 0.4s ease forwards;
    opacity: 0;
    animation-delay: var(--card-delay, 0s);
    position: relative;
    overflow: hidden;
    min-height: 52px;
    cursor: pointer;
}

html.dark-mode .card-minimal {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.card-minimal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 191, 166, 0.03), transparent 50%);
    pointer-events: none;
}

.card-minimal:active {
    transform: scale(0.97);
}

.card-minimal-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.card-minimal-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.card-minimal-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    flex-shrink: 0;
    transition: var(--transition);
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 191, 166, 0.3);
}

.card-minimal-arrow svg {
    width: 14px;
    height: 14px;
    stroke: white;
    stroke-width: 2.5;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================ */
/* ========== حالت خالی ========== */
/* ============================================ */

.empty-state-glass {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

html.dark-mode .empty-state-glass {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state-glass p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.add-btn-glass {
    padding: 10px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Pinar', sans-serif;
}

.add-btn-glass:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 191, 166, 0.3);
}

/* ============================================ */
/* ========== BOTTOM NAV ========== */
/* ============================================ */

.bottom-nav-modern {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    z-index: 999;
    padding: 0 8px;
    flex-shrink: 0;
}

.bottom-nav-bg {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

html.dark-mode .bottom-nav-bg {
    background: rgba(20, 20, 26, 0.85);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bottom-nav-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    min-height: 64px;
    gap: 8px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-full);
    transition: var(--transition);
    flex: 1;
    min-width: 0;
}

.nav-left:hover {
    background: rgba(0, 0, 0, 0.04);
}

html.dark-mode .nav-left:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 191, 166, 0.3);
    transition: var(--transition);
}

.nav-avatar:hover {
    transform: scale(1.05);
}

.nav-avatar-text {
    font-size: 0.8rem;
}

.nav-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.nav-user-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-status {
    font-size: 0.5rem;
    color: #2ECC71;
    font-weight: 500;
}

.nav-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-logout-btn-main {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Pinar', sans-serif;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

html.dark-mode .nav-logout-btn-main {
    background: rgba(255, 255, 255, 0.06);
}

.nav-logout-btn-main:hover {
    background: #E74C3C;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.nav-logout-btn-main svg {
    width: 16px;
    height: 16px;
}

/* ============================================ */
/* ========== MODAL GLASS ========== */
/* ============================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease forwards;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-glass {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

html.dark-mode .modal-glass {
    background: rgba(20, 20, 26, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
}

.modal-header-glass {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header-glass h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-glass {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

html.dark-mode .modal-close-glass {
    background: rgba(255, 255, 255, 0.06);
}

.modal-close-glass:hover {
    background: rgba(0, 0, 0, 0.08);
}

.form-group-glass {
    margin-bottom: 16px;
}

.form-group-glass label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group-glass input[type="text"],
.form-group-glass input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: 'Pinar', sans-serif;
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
}

html.dark-mode .form-group-glass input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.form-group-glass input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 191, 166, 0.15);
}

.submit-btn-glass {
    width: 100%;
    padding: 12px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Pinar', sans-serif;
}

.submit-btn-glass:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 191, 166, 0.3);
}

/* ============================================ */
/* ========== RESPONSIVE ========== */
/* ============================================ */

@media (min-width: 768px) {
    .app-mobile {
        max-width: 100%;
        padding: 0 32px 80px;
    }

    .bottom-nav-modern {
        max-width: 100%;
        bottom: 20px;
        width: calc(100% - 64px);
    }

    .bottom-nav-content {
        min-height: 68px;
        padding: 8px 16px;
    }

    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .content-title {
        font-size: 1.5rem;
    }

    .card-minimal {
        padding: 16px 20px;
        min-height: 60px;
        gap: 14px;
    }

    .card-minimal-icon {
        width: 42px;
        height: 42px;
    }

    .card-minimal-title {
        font-size: 0.9rem;
    }

    .card-minimal-arrow {
        width: 32px;
        height: 32px;
    }

    .card-minimal-arrow svg {
        width: 16px;
        height: 16px;
    }

    .card-minimal:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        border-color: var(--primary);
    }

    .nav-avatar {
        width: 42px;
        height: 42px;
    }

    .nav-user-name {
        font-size: 0.85rem;
    }

    .nav-user-status {
        font-size: 0.55rem;
    }

    .nav-logout-btn-main {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .main-mobile {
        max-height: calc(100vh - 200px);
        max-height: calc(100dvh - 200px);
    }
}

@media (min-width: 1024px) {
    .app-mobile {
        padding: 0 40px 80px;
    }

    .bottom-nav-modern {
        max-width: 1200px;
        bottom: 28px;
        width: calc(100% - 80px);
    }

    .bottom-nav-content {
        min-height: 76px;
        padding: 8px 20px;
    }

    .cards-grid {
        gap: 16px;
    }

    .card-minimal {
        padding: 18px 24px;
        min-height: 64px;
        gap: 16px;
    }

    .card-minimal-icon {
        width: 46px;
        height: 46px;
    }

    .card-minimal-title {
        font-size: 0.95rem;
    }

    .card-minimal-arrow {
        width: 34px;
        height: 34px;
    }

    .nav-avatar {
        width: 46px;
        height: 46px;
        font-size: 1rem;
    }

    .nav-user-name {
        font-size: 0.9rem;
    }

    .main-mobile {
        max-height: calc(100vh - 220px);
        max-height: calc(100dvh - 220px);
    }
}

@media (max-width: 480px) {
    .header-glass {
        padding: 10px 14px;
    }

    .logo-glass-name {
        font-size: 0.8rem;
    }

    .logo-glass-sub {
        font-size: 0.6rem;
    }

    .content-title {
        font-size: 1rem;
    }

    .add-category-btn {
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    .modal-glass {
        padding: 24px 16px;
    }
}

/* ============================================ */
/* ========== DARK MODE OVERRIDES ========== */
/* ============================================ */

html.dark-mode .bg-blob-1 { opacity: 0.25; }
html.dark-mode .bg-blob-2 { opacity: 0.15; }
html.dark-mode .bg-blob-3 { opacity: 0.1; }
html.dark-mode .bg-blob-4 { opacity: 0.12; }

html.dark-mode .nav-logout-btn-main:hover {
    background: #C0392B;
}

/* ============================================ */
/* ========== SCROLLBAR ========== */
/* ============================================ */

::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    background: transparent;
}

* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ============================================ */
/* ========== SELECTION ========== */
/* ============================================ */

::selection {
    background: var(--primary);
    color: white;
}