:root {
    --bg-primary: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-input: #1a1a1a;
    --bg-input-readonly: #252525;
    --bg-code: #252525;
    --border-color: #2a2a2a;
    --border-input: #333333;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-green: #53fc18;
    --accent-purple: #9146ff;
    --accent-green-hover: #45d912;
    --accent-purple-hover: #7c3aed;
    --accent-red: #ef4444;
    --accent-red-hover: #dc2626;
    --gradient-primary: linear-gradient(135deg, #53fc18 0%, #45d912 28%, #7a5ce7 72%, #9146ff 100%);
    --gradient-primary-hover: linear-gradient(135deg, #4ee015 0%, #3bc50e 28%, #6a4dd6 72%, #7c3aed 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-green), var(--accent-purple));
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-green-hover), var(--accent-purple-hover));
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-purple) var(--bg-primary);
}

/* Themed Scrollbar Variants */
/* Kick (green) */
.scrollbar-kick::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #53fc18, #3ab510);
}
.scrollbar-kick::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #45d912, #2f960d);
}
.scrollbar-kick {
    scrollbar-color: #53fc18 var(--bg-primary);
}

/* Twitch (purple) */
.scrollbar-twitch::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #9146ff, #7c3aed);
}
.scrollbar-twitch::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #a970ff, #8b5cf6);
}
.scrollbar-twitch {
    scrollbar-color: #9146ff var(--bg-primary);
}

.header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-box {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #000000;
}

.logo-img {
    width: 36px;
    height: 36px;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-text:hover {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #71717a;
    text-decoration: none;
    border-radius: 8px;
    background: transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-user {
    font-size: 14px;
    color: #38b366;
}

.nav-logout {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.nav-logout:hover {
    color: var(--accent-red);
}

.nav-separator {
    width: 1px;
    height: 20px;
    background: linear-gradient(to bottom, transparent, var(--text-secondary), transparent);
    margin: 0 8px;
}

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    padding-top: 80px; /* Compensate for fixed header */
}

.main-content:has(.admin-layout),
.main-content:has(.automation-layout),
.main-content.admin-wide,
.main-content.automation-wide {
    max-width: 1600px;
}

.main-content-centered {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 8px;
}

.footer-links a {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
    text-decoration-color: var(--accent-green);
}

/* Modern Footer Navigation Links */
.footer-nav-modern {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-nav-modern .footer-nav-link {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #a1a1aa !important;
    -webkit-text-fill-color: #a1a1aa !important;
    text-decoration: none !important;
    border-radius: 8px;
    background: transparent !important;
    transition: all 0.2s ease;
}

.footer-nav-modern .footer-nav-link:hover {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
    text-decoration: none !important;
}

@media (max-width: 600px) {
    .footer-nav-modern {
        gap: 4px;
    }
    
    .footer-nav-modern .footer-nav-link {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

.footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-form {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: transparent;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 3px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    opacity: 1;
    border-color: #555;
}

.lang-btn.active {
    opacity: 1;
    border-color: var(--accent-green);
}

.flag-icon {
    width: 24px;
    height: 18px;
    border-radius: 5px;
    display: block;
    overflow: hidden;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
}

.card-sm {
    padding: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.form-input:focus {
    border-color: transparent;
    background-image: linear-gradient(var(--bg-input), var(--bg-input)), var(--gradient-primary);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.form-input:read-only {
    background-color: var(--bg-input-readonly);
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #53fc18 0%, #45d912 28%, #7a5ce7 72%, #9146ff 100%);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 8px rgba(83, 252, 24, 0.15), 0 2px 8px rgba(145, 70, 255, 0.1);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4ee015 0%, #3bc50e 28%, #6a4dd6 72%, #7c3aed 100%);
    box-shadow: 0 4px 12px rgba(83, 252, 24, 0.25), 0 4px 12px rgba(145, 70, 255, 0.2);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #333333;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #444444;
}

.btn-danger {
    background-color: var(--accent-red);
    color: var(--text-primary);
}

.btn-danger:hover {
    background-color: var(--accent-red-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.validation-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    color: var(--accent-red);
    font-size: 14px;
}

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.text-purple { color: var(--accent-purple); }
.text-red { color: var(--accent-red); }
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-center { text-align: center; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.pt-4 { padding-top: 16px; }
.p-4 { padding: 16px; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.w-full { width: 100%; }
.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 500px; }
.max-w-lg { max-width: 600px; }
.max-w-xl { max-width: 800px; }

.relative { position: relative; }
.absolute { position: absolute; }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gradient-primary);
    box-shadow: 0 0 8px rgba(83, 252, 24, 0.5), 0 0 8px rgba(145, 70, 255, 0.3);
}

.connection-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    position: relative;
    transition: border-color 0.2s;
}

.connection-item:hover {
    border-color: #3a3a3a;
}

.log-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    overflow: auto;
    max-height: 70vh;
    white-space: pre-wrap;
    line-height: 1.5;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-green);
}

.code {
    background-color: var(--bg-code);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 16px 0;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-green);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.login-title {
    text-align: center;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.inline-form {
    display: inline;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Tablet breakpoint (768px) */
@media (max-width: 768px) {
    .header {
        padding: 10px 16px;
    }
    
    .header-content {
        gap: 12px;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background-color: var(--bg-card);
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 16px;
        z-index: 1001;
        transition: right 0.3s ease;
        overflow-y: auto;
    }
    
    .nav.open {
        right: 0;
    }
    
    .nav-link, .nav-user, .nav-logout {
        font-size: 16px;
        padding: 12px 16px;
        width: 100%;
        border-bottom: none;
        border: 1px solid transparent;
        border-radius: 10px;
        margin-bottom: 4px;
    }
    
    .nav-link:hover {
        border-color: rgba(83, 252, 24, 0.3);
        transform: none;
    }
    
    .nav-link:last-of-type {
        border-bottom: none;
    }
    
    .nav-user {
        border-bottom: 1px solid var(--border-color);
    }
    
    /* Nav separator horizontal on mobile */
    .nav-separator {
        width: 100%;
        height: 1px;
        background: linear-gradient(to right, transparent, var(--text-secondary), transparent);
        margin: 8px 0;
    }
    
    /* User menu mobile styles */
    .user-menu {
        width: 100%;
        margin-top: 8px;
        padding-top: 0;
        border-top: none;
    }
    
    .user-avatar-btn {
        width: 50px;
        height: 50px;
    }
    
    .user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
        margin-top: 16px;
        min-width: auto;
        width: 100%;
    }
    
    .user-dropdown-header {
        text-align: left;
        padding: 0 0 12px 0;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 8px;
    }
    
    .user-dropdown-divider {
        display: none;
    }
    
    .user-dropdown-name {
        font-size: 16px;
    }
    
    .user-dropdown-username {
        font-size: 14px;
    }
    
    .user-dropdown-item {
        padding: 14px 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 16px;
    }
    
    .user-dropdown-item:last-child {
        border-bottom: none;
    }
    
    .user-dropdown-form {
        width: 100%;
    }
    
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    .nav-overlay.open {
        display: block;
    }
    
    .main-content {
        padding: 16px;
        padding-top: 72px; /* Compensate for fixed header */
    }
    
    .page-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .footer {
        padding: 12px 16px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .flex-wrap {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 12px 16px;
    }
    
    .form-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    .login-card {
        padding: 24px 20px;
        margin: 16px;
    }
    
    .login-title {
        font-size: 18px;
    }
    
    .login-subtitle {
        font-size: 13px;
    }
    
    .modal-content {
        margin: 16px;
        padding: 20px;
        max-width: calc(100% - 32px);
    }
    
    .log-container {
        font-size: 11px;
        max-height: 60vh;
    }
    
    .max-w-sm, .max-w-md, .max-w-lg, .max-w-xl {
        max-width: 100%;
    }
}

/* Small mobile breakpoint (480px) */
@media (max-width: 480px) {
    .header {
        padding: 8px 12px;
    }
    
    .logo-box {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .logo-text {
        font-size: 14px;
    }
    
    .main-content {
        padding: 12px;
        padding-top: 68px; /* Compensate for fixed header */
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .section-title {
        font-size: 15px;
    }
    
    .card {
        padding: 12px;
        border-radius: 6px;
    }
    
    .card-sm {
        padding: 10px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .footer {
        padding: 10px 12px;
    }
    
    .footer-content {
        font-size: 11px;
    }
    
    .login-card {
        padding: 20px 16px;
        margin: 12px;
    }
    
    .login-logo img {
        width: 48px !important;
        height: 48px !important;
    }
    
    .text-xs { font-size: 11px; }
    .text-sm { font-size: 13px; }
    .text-base { font-size: 14px; }
    .text-lg { font-size: 16px; }
    .text-xl { font-size: 18px; }
    .text-2xl { font-size: 20px; }
    
    .gap-4 { gap: 12px; }
    .gap-6 { gap: 16px; }
    
    .mb-4 { margin-bottom: 12px; }
    .mb-6 { margin-bottom: 16px; }
    .mt-4 { margin-top: 12px; }
    .mt-6 { margin-top: 16px; }
    
    .code {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .validation-error {
        padding: 10px;
        font-size: 13px;
    }
}

/* Touch-friendly elements */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .action-btn {
        min-height: 44px;
    }
    
    .form-input, select {
        min-height: 44px;
    }
    
    .checkbox-label {
        padding: 8px 0;
    }
    
    .checkbox-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .main-content {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .footer {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Notification Toast System */
.notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

.notification-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
    overflow: hidden;
}

.notification-toast.warning {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.notification-toast.error {
    border-color: var(--accent-red);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.notification-toast.success {
    border-color: var(--accent-green);
}

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

.notification-icon {
    flex-shrink: 0;
    color: #f59e0b;
}

.notification-toast.error .notification-icon {
    color: var(--accent-red);
}

.notification-toast.success .notification-icon {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin: -4px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.notification-close:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@media (max-width: 480px) {
    .notification-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* =====================================================
   USER AVATAR DROPDOWN
   ===================================================== */

.user-menu {
    position: relative;
}

.user-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                var(--gradient-primary) border-box;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(83, 252, 24, 0.2);
}

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

.user-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: #666;
}

.user-avatar-placeholder svg {
    width: 20px;
    height: 20px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

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

.user-dropdown-header {
    padding: 16px;
    text-align: center;
}

.user-dropdown-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-dropdown-username {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.user-dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.user-dropdown-item:hover svg {
    color: var(--accent-green);
}

.user-dropdown-item.logout {
    color: var(--accent-red);
}

.user-dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.user-dropdown-item.logout:hover svg {
    color: var(--accent-red);
}

.user-dropdown-form {
    display: block;
}

/* Nav user old styles - can be removed */
.nav-user {
    display: none;
}

.nav-logout {
    display: none;
}

/* =====================================================
   CUSTOM DROPDOWN - ANIMATED MENU
   ===================================================== */

.custom-dropdown {
    position: relative;
}

/* Trigger Button */
.custom-dropdown-button {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    
    /* Arrow icon */
    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='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.custom-dropdown-button:hover,
.custom-dropdown-button:focus {
    border-color: var(--accent-green);
    outline: none;
}

/* Arrow inverted when open */
.custom-dropdown.open .custom-dropdown-button {
    border-color: var(--accent-green);
    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='%2353fc18' stroke-width='2'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
}

/* Menu Container */
.custom-dropdown-menu {
    background: #1a1a1a;
    padding: 6px;
    margin: 0;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    list-style: none;
    
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 100%;
    z-index: 100;
    
    /* Elegant shadow */
    box-shadow: 
        rgba(0, 0, 0, 0.1) 0px 1px 1px -0.5px, 
        rgba(0, 0, 0, 0.15) 0px 2px 2px -1px, 
        rgba(0, 0, 0, 0.15) 0px 3px 3px -1.5px, 
        rgba(0, 0, 0, 0.1) 0px 5px 5px -2.5px, 
        rgba(0, 0, 0, 0.1) 0px 10px 10px -5px, 
        rgba(0, 0, 0, 0.15) 0px 24px 24px -8px;
    
    /* Spring animation */
    --spring: linear(0, 0.008 1.1%, 0.034 2.3%, 0.134 4.9%, 0.264 7.3%, 0.683 14.3%, 0.797 16.5%, 0.89 18.6%, 0.967 20.7%, 1.027 22.8%, 1.073 25%, 1.104 27.3%, 1.123 30.6%, 1.119 34.3%, 1.018 49.5%, 0.988 58.6%, 0.985 65.2%, 1 84.5%, 1);
    
    transition-property: scale, translate, opacity, display;
    transition-timing-function: var(--spring);
    transition-duration: 0.5s;
    transition-behavior: allow-discrete;
    
    /* Closed state */
    opacity: 0;
    scale: 1 0.25;
    translate: 0 -24px;
    display: none;
    transform-origin: center top;
    transform: translate3d(0, 0, 0.01px);
}

/* Open state */
.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    scale: 1 1;
    translate: 0 0;
    display: flex;
}

/* Menu Items */
.custom-dropdown-menu li {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
    font-size: 14px;
    
    /* Individual item animation */
    transition-property: translate, opacity, background-color, color;
    transition-timing-function: var(--spring);
    transition-duration: 0.5s;
    transition-behavior: allow-discrete;
    
    transform-origin: center top;
    translate: 0 20%;
    opacity: 0;
    transform: translate3d(0, 0, 0.01px);
}

/* Items visible when open */
.custom-dropdown.open .custom-dropdown-menu li {
    translate: 0 0;
    opacity: 1;
}

/* Staggered delay for each item */
.custom-dropdown-menu li:nth-child(1) { transition-delay: 0.02s; }
.custom-dropdown-menu li:nth-child(2) { transition-delay: 0.05s; }
.custom-dropdown-menu li:nth-child(3) { transition-delay: 0.08s; }
.custom-dropdown-menu li:nth-child(4) { transition-delay: 0.11s; }
.custom-dropdown-menu li:nth-child(5) { transition-delay: 0.14s; }
.custom-dropdown-menu li:nth-child(6) { transition-delay: 0.17s; }
.custom-dropdown-menu li:nth-child(7) { transition-delay: 0.20s; }
.custom-dropdown-menu li:nth-child(8) { transition-delay: 0.23s; }
.custom-dropdown-menu li:nth-child(9) { transition-delay: 0.26s; }
.custom-dropdown-menu li:nth-child(10) { transition-delay: 0.29s; }

/* Hover state */
.custom-dropdown-menu li:hover {
    background: rgba(83, 252, 24, 0.1);
    color: var(--accent-green);
}

/* Selected item */
.custom-dropdown-menu li.selected {
    background: rgba(83, 252, 24, 0.15);
    color: var(--accent-green);
}

.custom-dropdown-menu li.selected:hover {
    background: rgba(83, 252, 24, 0.2);
}

/* @starting-style for initial animation */
@starting-style {
    .custom-dropdown.open .custom-dropdown-menu {
        opacity: 0;
        scale: 1 0.25;
        translate: 0 -24px;
        display: flex;
    }
    .custom-dropdown.open .custom-dropdown-menu li {
        translate: 0 20%;
        opacity: 0;
    }
}

/* ISP variant (blue) */
.custom-dropdown.isp .custom-dropdown-button:hover,
.custom-dropdown.isp .custom-dropdown-button:focus,
.custom-dropdown.isp.open .custom-dropdown-button {
    border-color: #60a5fa;
}

.custom-dropdown.isp.open .custom-dropdown-button {
    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='%2360a5fa' stroke-width='2'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
}

.custom-dropdown.isp .custom-dropdown-menu li:hover {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
}

.custom-dropdown.isp .custom-dropdown-menu li.selected {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.custom-dropdown.isp .custom-dropdown-menu li.selected:hover {
    background: rgba(96, 165, 250, 0.2);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .custom-dropdown-button {
        padding: 14px 16px;
        padding-right: 40px;
        font-size: 16px;
    }
    
    .custom-dropdown-menu li {
        padding: 14px 16px;
        font-size: 16px;
    }
}

/* ============================================
   MOBILE APP BOTTOM NAVIGATION
   Only visible when running in Capacitor/WebView
   ============================================ */

.mobile-app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: none; /* Hidden by default, shown via JS when in app mode */
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 10000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

/* When in mobile app mode, show mobile nav */
html.mobile-app-mode .mobile-app-nav {
    display: flex;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 64px;
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.mobile-nav-item span {
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-nav-item.active {
    color: var(--accent-green);
}

.mobile-nav-item.active svg {
    stroke: var(--accent-green);
    filter: drop-shadow(0 0 8px rgba(83, 252, 24, 0.4));
}

.mobile-nav-item.active span {
    color: var(--accent-green);
    font-weight: 600;
}

/* Adjust main content when mobile nav is visible */
body.mobile-app-mode {
    padding-bottom: 80px;
}

body.mobile-app-mode .main-content {
    padding-top: 16px;
    padding-bottom: 90px;
    min-height: calc(100vh - 90px);
}

body.mobile-app-mode .footer {
    display: none !important;
}

body.mobile-app-mode .header {
    display: none !important;
}

/* Animation for mobile nav items */
@keyframes mobileNavPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.mobile-nav-item:active svg {
    animation: mobileNavPulse 0.2s ease;
}
