/* 
    Modern Design System 
    Author: Antigravity AI
*/

:root {
    /* Color Palette (Dynamic base) */
    --primary: #6366f1;
    --primary-hover: color-mix(in srgb, var(--primary), black 15%);
    --secondary: #06b6d4;
    --secondary-hover: color-mix(in srgb, var(--secondary), black 15%);
    --accent: #f43f5e;
    
    /* Dark Theme (Default) */
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Spacing & Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* Layout Components */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
#navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    height: 80px;
    display: flex;
    align-items: center;
    transition: var(--transition-base);
}

#navbar.scrolled {
    height: 70px;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.nav-link:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 80px;
    background-image: linear-gradient(to bottom, rgba(15, 23, 42, 0.5), var(--bg-main)), url('../assets/hero_background.png');
    background-size: cover;
    background-position: center;
}

.hero-content {
    max-width: 700px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
    white-space: nowrap;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-family: inherit;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5), 0 0 15px var(--primary);
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    backdrop-filter: blur(5px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Features Section */
.section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, min-minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition-base);
}

.card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
}

.card-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.card h3 {
    margin-bottom: 1rem;
}

.card p {
    color: var(--text-muted);
}

/* Animations */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

[data-animate].visible {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.menu-toggle span {
    width: 30px;
    height: 2px;
    background: var(--text-main);
    transition: var(--transition-base);
}

/* Customizer Styles */
#customizer {
    position: fixed;
    right: -350px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    padding: 2rem;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
}

#customizer.active {
    right: 0;
}

.customizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.customizer-header button {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.customizer-header button:hover {
    color: var(--accent);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.input-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
}

.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column-reverse; /* Stack upward */
    gap: 15px;
    z-index: 1000;
}

.btn-fab {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-main);
    transition: var(--transition-base);
}

.btn-fab:hover {
    transform: scale(1.1) rotate(15deg);
    background: var(--primary);
    color: white;
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
    border-color: var(--primary);
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* AI Chat Widget */
#ai-chat-widget {
    position: fixed;
    bottom: 180px;
    right: -400px;
    width: 350px;
    height: 500px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

#ai-chat-widget.active {
    right: 30px;
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Premium aesthetic scrollbar for chat widget */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.message {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    max-width: 80%;
    font-size: 0.9rem;
}

.message.ai {
    background: var(--bg-card);
    align-self: flex-start;
    border: 1px solid var(--border);
}

.message.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
}

.chat-footer {
    padding: 1.2rem 1.5rem;
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--border);
}

#chat-input {
    flex: 1;
    min-width: 0; /* CRITICAL: Allows input to shrink, preventing button overflow */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px; /* Modern pill style input */
    padding: 8px 16px;
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition-base);
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

#send-chat {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%; /* Unified circular shape */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition-base);
}

#send-chat:hover {
    background: var(--primary-hover);
    transform: scale(1.08);
}

/* Form Controls & Selects */
.form-control {
    width: 100%;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 0 15px rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

.toggle-pass {
    transition: all 0.2s ease;
    opacity: 0.6;
}

.toggle-pass:hover {
    color: var(--primary) !important;
    opacity: 1;
    transform: translateY(-50%) scale(1.1) !important;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
    padding-right: 45px;
}

option {
    background-color: var(--bg-main);
    color: var(--text-main);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.pulse {
    animation: pulse 1.5s infinite;
}

/* --- Responsive Grid Layouts --- */
.responsive-grid {
    grid-template-columns: var(--desktop-cols, 1fr);
}
.responsive-grid > * {
    min-width: 0;
}

/* --- Mobile Table Modal --- */
.mobile-table-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end; /* Slides up from bottom like a sheet */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-table-modal.show {
    display: flex;
    opacity: 1;
}
.mobile-table-modal-content {
    width: 100%;
    max-height: 90vh;
    background: var(--bg-main);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: 20px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
}
.mobile-table-modal.show .mobile-table-modal-content {
    transform: translateY(0);
}
.mobile-table-row-data {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.mobile-table-row-item {
    background: rgba(255,255,255,0.03);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.05);
}
.mobile-table-row-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 4px;
}
.mobile-table-row-value {
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}
.mobile-table-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}
.mobile-table-actions button, .mobile-table-actions a {
    width: 100% !important;
    justify-content: center;
}

/* --- Responsive Design (System Wide Fixes) --- */
@media (max-width: 850px) {
    /* Interactive Tables on Mobile */
    table tbody tr {
        cursor: pointer;
        transition: background 0.2s ease;
        position: relative;
    }
    table tbody tr:hover, table tbody tr:active {
        background: rgba(255,255,255,0.05);
    }
    /* Añadir pequeño indicador visual (opcional) */
    table tbody tr::after {
        content: "\EB7A"; /* ri-arrow-right-s-line from remix icon */
        font-family: "remixicon";
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        opacity: 0.5;
        font-size: 1.2rem;
        pointer-events: none;
    }
    table tbody tr td:last-child {
        padding-right: 35px !important; /* space for arrow */
    }

    .responsive-grid {
        grid-template-columns: 1fr !important;
    }

    /* Global Mobile Typography Adjustments */
    html {
        font-size: 14px; /* Reduce base font size from 16px to 14px on mobile */
    }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Navbar responsive: el menú hamburguesa aparece en móviles y pantallas reducidas (hasta 850px) */
@media (max-width: 850px) {
    .nav-links {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        max-width: 320px;
        height: calc(100vh - 80px);
        background: var(--bg-main);
        box-shadow: 10px 0 40px rgba(0,0,0,0.35);
        flex-direction: column;
        padding: 30px;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overscroll-behavior: contain;
        align-items: stretch;
        gap: 0.8rem;
        z-index: 9999;
    }
    .nav-links.active {
        left: 0;
    }
    .menu-toggle {
        display: flex;
    }
}

/* Para pantallas medianas (851px - 1300px) */
@media (max-width: 1300px) and (min-width: 851px) {
    .nav-links {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        max-width: 360px;
        height: calc(100vh - 80px);
        background: var(--bg-main);
        box-shadow: 10px 0 40px rgba(0,0,0,0.35);
        flex-direction: column;
        padding: 30px;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overscroll-behavior: contain;
        align-items: stretch;
        gap: 0.5rem;
        z-index: 9999;
    }
    .nav-links.active {
        left: 0;
    }
    .menu-toggle {
        display: flex;
    }
}
/* Fin navbar responsive */
/* Admin Specific Styles */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 75px;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar .logo {
    padding: 0 1rem;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    transition: var(--transition-base);
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.sidebar-link.active {
    background: var(--primary);
    color: white;
}

.sidebar-link i {
    min-width: 24px;
    font-size: 1.2rem;
}

.sidebar-link span {
    transition: opacity 0.2s ease;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100vw - var(--sidebar-width));
}

.admin-layout.collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding: 1.5rem 0.25rem;
}

.admin-layout.collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    max-width: calc(100vw - var(--sidebar-collapsed-width));
}

.admin-layout.collapsed .logo-text, 
.admin-layout.collapsed .sidebar-link span,
.admin-layout.collapsed .user-info {
    display: none;
}

.admin-layout.collapsed .logo {
    justify-content: center;
    padding: 0;
}

.admin-layout.collapsed .logo-icon {
    margin: 0;
    font-size: 1.5rem;
}

.admin-layout.collapsed .sidebar-link {
    justify-content: center;
    padding: 12px 0;
    margin: 0 0.5rem;
}

.admin-layout.collapsed .sidebar-footer .glass {
    justify-content: center;
    padding: 0.8rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.toggle-sidebar {
    position: absolute;
    right: -14px;
    top: 60px;
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    border: 2px solid var(--bg-card);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1100;
    transition: var(--transition-base);
}

.toggle-sidebar:hover {
    transform: scale(1.1);
    background: var(--secondary);
}

.file-upload-wrapper {
    position: relative;
    width: 100%;
    padding: 2.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    gap: 15px;
    overflow: hidden;
}

.file-upload-wrapper:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-info {
    text-align: center;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.file-upload-info i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: block;
}

.file-upload-wrapper.has-file {
    border-style: solid;
    border-color: var(--success, #10b981);
    background: rgba(16, 185, 129, 0.05);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 45px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--primary);
}

.glass::-webkit-scrollbar {
    width: 6px;
}

.glass::-webkit-scrollbar-track {
    background: transparent;
}

.glass::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.glass::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Notification Toast Styles */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 99999;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid var(--accent); }
.toast.info { border-left: 4px solid var(--primary); }

.toast i {
    font-size: 1.25rem;
}

.toast.success i { color: #10b981; }
.toast.error i { color: var(--accent); }
.toast.info i { color: var(--primary); }

/* Confirm Modal Custom */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}
.confirm-modal {
    width: 90%;
    max-width: 420px;
    padding: 2.5rem;
    background: rgba(20, 20, 35, 0.95);
    border-radius: var(--radius-lg);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 30px 60px -12px rgba(0,0,0,0.9);
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
.confirm-overlay.show .confirm-modal {
    transform: scale(1) translateY(0);
}
.confirm-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    color: var(--primary);
}
.confirm-header i { width: 50px; height: 50px; opacity: 0.9; color: var(--accent); }
.confirm-header h4 { margin: 0; font-size: 1.6rem; color: #fff; font-weight: 700; }
.confirm-modal p { color: rgba(255,255,255,0.7); line-height: 1.6; margin-bottom: 2.5rem; font-size: 1.15rem; }
.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.confirm-actions .btn { padding: 14px 28px; min-width: 130px; font-weight: 600; border-radius: var(--radius-md); }
.confirm-actions .btn-primary { background: var(--accent); border-color: var(--accent); }
.confirm-actions .btn-primary:hover { background: #e11d48; transform: translateY(-2px); }

/* Standard Form Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

/* ==========================================
   Mobile Premium Responsiveness & Touch Adjustments
   ========================================== */
@media (max-width: 768px) {
    /* 1. Flex layouts adapting to columns */
    .admin-layout {
        flex-direction: column !important;
    }
    .sidebar .logo {
        margin-bottom: 1rem !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 1.5rem 1rem !important;
    }
    
    .responsive-grid {
        grid-template-columns: 1fr !important;
    }
    
    .stats-grid, .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* 2. Responsive Tables with native horizontal scroll */
    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-top: 1rem !important;
        border-radius: var(--radius-md) !important;
        border: 1px solid var(--border) !important;
    }
    
    table, .table-premium {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    table th, table td {
        white-space: nowrap !important;
        padding: 12px 16px !important;
    }

    /* 3. Larger touch targets (buttons, inputs) */
    .btn, button, .password-toggle, .btn-fab {
        min-height: 44px !important;
        min-width: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .btn-sm {
        min-height: 38px !important;
        padding: 8px 16px !important;
    }

    /* 4. Chat bubble adjustments for mobile spacing */
    .message {
        max-width: 85% !important;
    }
    
    /* 5. Custom improvements for other layout flexboxes */
    .chat-footer {
        padding: 0.8rem !important;
        gap: 8px !important;
    }
    
    /* 7. Live Chat Layout Responsive Fixes */
    .chat-container {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 180px) !important; /* adjust to prevent scroll */
    }
    .chat-list {
        width: 100% !important;
        height: 40% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border) !important;
    }
    .chat-window {
        width: 100% !important;
        height: 60% !important;
    }
    #active-account-selector {
        width: 150px !important;
    }
    
    /* 6. Header responsiveness */
    .main-content header {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    .main-content header > div:first-child {
        min-width: 0;
        flex: 0 1 auto;
        overflow: hidden;
    }
    .main-content header > div:last-child {
        flex: 0 0 auto;
        gap: 5px !important;
    }
    #page-main-title {
        font-size: 1.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 480px) {
    .confirm-modal {
        padding: 1.5rem !important;
        width: 95% !important;
    }
    .confirm-modal p {
        font-size: 1.05rem !important;
        margin-bottom: 1.8rem !important;
    }
    .confirm-actions {
        flex-direction: column-reverse !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .confirm-actions .btn {
        width: 100% !important;
        min-width: 0 !important;
        padding: 12px !important;
    }
    .confirm-header h4 {
        font-size: 1.4rem !important;
    }
}

/* AI Chat Mobile Fullscreen */
@media (max-width: 768px) {
    #ai-chat-widget {
        width: 100% !important;
        height: 100% !important;
        bottom: 0 !important;
        right: -100% !important;
        border-radius: 0 !important;
        z-index: 999999 !important; /* Above bottom nav */
    }
    #ai-chat-widget.active {
        right: 0 !important;
    }
}
