:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #7c3aed;
    --bg-app: #0a0a0c;
    --bg-surface: rgba(255, 255, 255, 0.05);
    --bg-surface-hover: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --error: #ef4444;
    --success: #10b981;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-stroke: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --gradient-main: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    /* Additional variables for compatibility */
    --bg-dark: #0a0a0c;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);
}

.light-theme {
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-stroke: rgba(0, 0, 0, 0.05);
    /* Additional variables for compatibility with login/signup */
    --bg-dark: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-stroke);
    border-radius: 16px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--gradient-main);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-muted);
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Navigation System (Sidebar) */
.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--border);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    background: var(--bg-app);
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
    text-decoration: none;
    color: white;
}

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.logo span {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-link {
    margin-bottom: 8px;
}

.nav-link a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link a:hover, .nav-link.active a {
    background: var(--bg-surface);
    color: var(--text-main);
}

.nav-link.active a {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
}

.page-title {
    flex: 1;
    min-width: 0; /* Crucial for preventing flex blowout */
}

.page-title h1 {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    margin-bottom: 4px;
    word-break: break-word;
    line-height: 1.2;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    word-break: break-word;
    line-height: 1.3;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 32px 12px; }
    .logo span, .nav-link span { display: none; }
    .main-content { margin-left: 80px; }
}

@media (max-width: 768px) {
    .sidebar { 
        display: flex;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        position: fixed;
        width: 280px;
        z-index: 1001;
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .main-content { 
        margin-left: 0; 
        padding: 24px 16px; 
        width: 100%; 
        overflow-x: hidden; 
    }
    .mobile-menu-btn { display: block !important; }
}
/* Language Toggle & Transaction Utils */
.lang-btn { background: none; border: none; color: white; cursor: pointer; font-weight: 500; opacity: 0.5; transition: all 0.3s ease; font-family: inherit; font-size: 0.9rem; }
.lang-btn.active { opacity: 1; font-weight: 800; color: var(--primary); }
.lang-btn:hover { opacity: 0.8; }
.text-success { color: var(--success) !important; }
.text-error { color: var(--error) !important; }
.bg-success-light { background: rgba(16, 185, 129, 0.1) !important; }
.bg-error-light { background: rgba(239, 68, 68, 0.1) !important; }

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn:hover { background: var(--bg-surface-hover); }

/* --- Global Modal System --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    animation: modalIn 0.3s ease-out forwards;
    width: 100%;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}


/* --- Toast Notification System --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 450px;
    padding: 16px 20px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    transition: all 0.3s ease;
}

.toast.hide {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Types */
.toast-success { border-left: 4px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

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

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

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@media (max-width: 768px) {
    #toast-container {
        bottom: auto;
        top: 20px;
        right: 20px;
        left: 20px;
        align-items: center;
    }
    .toast {
        min-width: auto;
        width: 100%;
    }
}

