/**
 * ПЭРУМ Base Styles
 * Common reset and utility classes
 * 
 * CSS Variables are now defined in brand.css
 */

/* ========================================
   Reset & Base
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

ul,
ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

/* ========================================
   Buttons
   ======================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 24px;
    background: var(--color-primary);
    color: white;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 24px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-primary);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    background: transparent;
    color: var(--color-primary);
    font-weight: 500;
    border: 1px solid var(--color-primary);
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.btn-outline:hover {
    background: var(--color-primary-light);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 24px;
    background: var(--color-danger);
    color: white;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.btn-danger:hover {
    background: #dc2626;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.form-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    transition: all var(--transition-normal);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Modals — Unified Premium Style
   ======================================== */

/* Overlay: fixed fullscreen container */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal, 1100);
    padding: 20px;
}

.modal.hidden {
    display: none !important;
}

/* Backdrop: blurred dark overlay */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Card: main modal container */
.modal-content {
    position: relative;
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modal-in 0.25s ease;
    padding: 0;
}

/* Gradient accent line at top */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #3b82f6, #6366f1);
    z-index: 1;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Size variants */
.modal-content.modal-lg {
    max-width: 600px;
}

.modal-content.modal-xl {
    max-width: 800px;
}

/* Header */
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 24px 12px;
    margin-bottom: 0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary, #fff);
}

/* Close button: rounded circle */
.modal-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #888);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Body */
.modal-body {
    padding: 12px 24px 24px;
    max-height: 60vh;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.2);
    border-radius: 4px;
}

/* Form inside modal */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 24px 24px;
}

/* Standardized form elements inside modals */
.modal-body .form-group,
.modal-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-body label,
.modal-form label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
}

.modal-body input,
.modal-body select,
.modal-body textarea,
.modal-form input,
.modal-form select,
.modal-form textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-md, 8px);
    color: var(--text-primary, #fff);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus,
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: var(--accent-primary, #0ea5e9);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.modal-body textarea,
.modal-form textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-body .btn,
.modal-body button[type="submit"],
.modal-form .btn,
.modal-form button[type="submit"] {
    padding: 10px 20px;
    border-radius: var(--radius-md, 8px);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-body .btn-primary,
.modal-form .btn-primary {
    background: var(--accent-gradient, linear-gradient(135deg, #0ea5e9, #6366f1));
    color: #fff;
    border: none;
}

.modal-body .btn-primary:hover,
.modal-form .btn-primary:hover {
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
    transform: translateY(-1px);
}

/* Actions (footer buttons) */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 24px;
}

/* ---- Mobile: bottom-sheet style ---- */
@media (max-width: 640px) {
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }

    .modal-header {
        padding: 20px 20px 8px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 12px 20px 20px;
        max-height: 65vh;
    }

    .modal-actions {
        padding: 0 20px 20px;
    }
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s ease;
    pointer-events: auto;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-success {
    border-left: 3px solid var(--color-success);
}

.toast-error {
    border-left: 3px solid var(--color-danger);
}

.toast-warning {
    border-left: 3px solid var(--color-warning);
}

.toast-info {
    border-left: 3px solid var(--color-info);
}

/* ========================================
   Header
   ======================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    transition: all var(--transition-normal);
}

/* Add padding-top for content wrapper when header is present */
.app-container:has(.app-header) .content-wrapper {
    padding-top: var(--header-height, 60px);
}

/* Fallback for old pages without content-wrapper structure */
.app-container>.main-content:first-child,
.app-container>.profile-main:first-child,
.app-container>.schedule-page:first-child,
.app-container>.wallet-page:first-child,
.app-container>.journal-page:first-child {
    padding-top: var(--header-height, 60px);
}

/* Mobile header - centered logo, floating style like bottom nav */
@media (max-width: 1099px) {
    :root {
        --header-height: 80px;
    }

    .app-header {
        justify-content: center;
        padding: 0 16px;
        height: 48px;
        box-sizing: border-box;
        /* Floating style like mobile bottom nav */
        top: 16px;
        left: 12px;
        right: 12px;
        border-radius: var(--glass-radius);
        box-shadow: var(--glass-shadow);
    }

    .header-left {
        margin: 0 auto;
        gap: 10px;
    }

    .header-left .logo-small {
        width: 32px;
        height: 32px;
    }

    .header-left .logo-small svg {
        width: 20px;
        height: 20px;
    }

    .header-title {
        font-size: 1rem;
        font-weight: 700;
    }

    /* On mobile: show only balance inside header-right, hide notifications and user menu */
    .header-right {
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
    }

    .header-right .notification-wrapper,
    .header-right .user-menu {
        display: none !important;
    }

    /* Hide desktop nav on mobile */
    .header-nav.desktop-only {
        display: none !important;
    }
}

/* Floating header on desktop - летающий стиль */
@media (min-width: 1100px) {
    :root {
        --header-height: 90px;
    }

    .app-header {
        top: 16px;
        left: 16px;
        right: 16px;
        border-radius: var(--glass-radius);
        box-shadow: var(--glass-shadow);
    }
}

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

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-small {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Gradient text for header title like landing page */
.header-title-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Logo glow effect */
.logo-glow {
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(14, 165, 233, 0.6);
    }
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.back-link:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Desktop Navigation */
.header-nav {
    display: none;
    /* Hidden by default (mobile) */
    align-items: center;
    gap: 4px;
    margin-left: 24px;
    flex: 1;
    max-width: 500px;
}

@media (min-width: 1100px) {
    .header-nav.desktop-only {
        display: flex;
        justify-content: center;
    }
}

.header-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.header-nav .nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.header-nav .nav-item:hover {
    color: var(--accent-tertiary);
    background: rgba(14, 165, 233, 0.1);
    border-color: var(--border-hover);
}

.header-nav .nav-item.active {
    color: var(--accent-tertiary);
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.2);
}

.header-nav .nav-item.active svg {
    stroke: var(--accent-tertiary);
    color: var(--accent-tertiary);
}

/* Hide profile link in desktop nav since we have user menu on the right */
@media (min-width: 1100px) {
    .header-nav .nav-item[href="/main/profile"] {
        display: none;
    }
}

/* Old nav-tab styles (legacy, keep for compatibility) */
.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--text-primary);
    background: var(--bg-card);
}

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

/* Header Buttons */
.header-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.header-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--color-danger);
    border-radius: var(--radius-full);
    font-size: 0.625rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Notification Dropdown */
.notification-wrapper {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.notification-dropdown:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.notification-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-all-btn {
    padding: 4px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-all-btn:hover {
    color: var(--color-danger);
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.notification-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.notification-empty p {
    font-size: 0.875rem;
}

/* Header Balance Display */
.header-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    height: 40px;
}

.header-balance:hover {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.05);
}

.header-balance .coin-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.header-balance .balance-value {
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.header-balance .balance-diff {
    font-size: 0.75rem;
    margin-left: 2px;
    font-weight: 400;
    opacity: 0.7;
    line-height: 1;
}

.header-balance .balance-diff.positive {
    color: var(--color-success);
}

.header-balance .balance-diff.negative {
    color: var(--color-danger);
}

/* Header balance on mobile — smaller size */
@media (max-width: 1099px) {
    .header-balance {
        padding: 6px 10px;
        font-size: 0.8125rem;
        height: 34px;
    }

    .header-balance .balance-diff {
        display: none;
    }
}

/* User Menu */

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.user-menu-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.chevron {
    transition: transform var(--transition-fast);
}

.user-menu.open .chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
}

.user-menu.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    width: 100%;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-item.logout:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.dropdown-item.has-submenu {
    position: relative;
}

.submenu-arrow {
    margin-left: auto;
}

.submenu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 8px;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
}

.dropdown-item.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.submenu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* ========================================
   Wallet Components
   ======================================== */





/* Wallet Section in Dropdown Menu - Mobile-Inspired Design */
.wallet-section {
    padding: 16px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(99, 102, 241, 0.08));
    border-radius: var(--radius-lg);
}

.dropdown-menu .wallet-section+.dropdown-divider {
    margin: 16px 0 0 0;
    height: 1px;
    background: var(--border-color);
}

/* Desktop Balance Row */
.desktop-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.desktop-balance-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.desktop-balance-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.desktop-balance-value>span:first-child {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.coin-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Desktop History Button */
.desktop-history-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.desktop-history-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.desktop-history-btn svg {
    flex-shrink: 0;
}


/* Period Dropdown */
.period-dropdown {
    margin-top: 8px;
    padding: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.period-option {
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.period-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.period-option.active {
    background: var(--accent-primary);
    color: white;
}

/* Transaction History Modal */
.wallet-history-modal-content {
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modal Stats Cards */
.modal-stats-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(99, 102, 241, 0.05));
    border-bottom: 1px solid var(--border-color);
}

.modal-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.modal-stat-card svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.modal-stat-card:first-child svg {
    color: var(--color-success);
}

.modal-stat-card:last-child svg {
    color: var(--color-danger);
}

.modal-stat-card>div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-stat-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.modal-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-stat-card:first-child .modal-stat-value {
    color: var(--color-success);
}

.modal-stat-card:last-child .modal-stat-value {
    color: var(--color-danger);
}


.transaction-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-group {
    grid-column: span 2;
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    padding-left: 36px;
}

/* Transaction List */
.transaction-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all var(--transition-fast);
}

.transaction-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.transaction-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.transaction-item.received .transaction-icon {
    color: var(--color-success);
}

.transaction-item.spent .transaction-icon {
    color: var(--color-danger);
}

.transaction-details {
    flex: 1;
    min-width: 0;
}

.transaction-description {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.transaction-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.transaction-amount {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.transaction-amount.received {
    color: var(--color-success);
}

.transaction-amount.spent {
    color: var(--color-danger);
}

/* Loading and Empty States */
.transaction-loading,
.transaction-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.transaction-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Transaction Pagination */
.transaction-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Mobile responsive for wallet */
@media (max-width: 1099px) {
    .dropdown-menu {
        min-width: 280px;
        max-width: calc(100vw - 32px);
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .transaction-filters {
        grid-template-columns: 1fr;
    }

    .search-group {
        grid-column: span 1;
    }

    .wallet-history-modal-content {
        max-width: calc(100vw - 32px);
    }
}

/* ========================================
   Select & Input Styles
   ======================================== */
select,
.filter-select {
    appearance: none;
    padding: 10px 36px 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239898a6' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

select:hover,
.filter-select:hover {
    border-color: var(--border-hover);
}

select:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

select:disabled,
.filter-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}

/* Input type date/datetime-local */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
    appearance: none;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="time"]:hover {
    border-color: var(--border-hover);
}

input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* WebKit date picker styling */
::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ========================================
   App Container
   ======================================== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-lg: 20px;
        --spacing-xl: 24px;
    }

    .user-name {
        display: none;
    }

    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -60px;
    }

    .modal-content {
        max-width: 100%;
        margin: var(--spacing-md);
    }

    .toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
    }

    .main-content {
        padding: 16px;
    }
}

/* Mobile bottom nav for teacher */
@media (max-width: 768px) {
    .teacher-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-around;
        padding: 12px 16px;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        z-index: var(--z-sticky);
    }

    .teacher-bottom-nav .nav-tab {
        flex-direction: column;
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .teacher-bottom-nav .nav-tab svg {
        margin-bottom: 4px;
    }

    .has-bottom-nav {
        padding-bottom: 80px;
    }
}