@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    /* --- Palettes: Midnight Luxury (Dark Default) --- */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Semantic Colors */
    --primary: #6366f1;
    --primary-rgb: 99, 102, 241;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;

    --secondary: #ec4899;
    --secondary-rgb: 236, 72, 153;

    --success: #10b981;
    --success-rgb: 16, 185, 129;

    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;

    --danger: #ef4444;
    --danger-rgb: 239, 68, 68;

    /* Backgrounds */
    --bg-body: #050b14;
    /* Deepest void */
    --bg-surface: #0f172a;
    /* Panel background */
    --bg-surface-glass: rgba(15, 23, 42, 0.7);
    --bg-navbar: rgba(5, 11, 20, 0.8);
    --bg-elevated: #1e293b;
    --bg-surface-secondary: #1e293b;
    /* Added for secondary panels */
    /* Hover/Modal states */

    /* Text & Borders */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;


    --border-color: rgba(148, 163, 184, 0.15);
    --border-highlight: rgba(99, 102, 241, 0.3);

    /* Effects */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4),
        0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    --glass-blur: blur(16px);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.3s;
}

[data-theme="light"] {
    --bg-body: #FDF5E6;
    --bg-surface: #FFFBFA;
    --bg-surface-glass: rgba(255, 251, 250, 0.85);
    --bg-navbar: rgba(253, 245, 230, 0.9);
    --bg-elevated: #F9F4E8;
    --bg-surface-secondary: #f1f5f9;
    /* Slate 100 for light mode */

    --text-main: #1e1b18;
    --text-muted: #6b635b;
    --text-dim: #948d85;

    --border-color: rgba(120, 110, 100, 0.2);

    --shadow-sm: 0 4px 6px -1px rgba(60, 50, 40, 0.05), 0 2px 4px -1px rgba(60, 50, 40, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(60, 50, 40, 0.08), 0 4px 6px -2px rgba(60, 50, 40, 0.04);
}

/* --- Resets & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color var(--duration-normal) var(--ease-out);
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--duration-fast);
}

/* --- Layout --- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    /* Wider for dashboard view */
    margin: 0 auto;
    padding: 2rem 1.5rem;
    animation: fadeIn 0.6s var(--ease-out);
}

/* --- Components: Typography & Badges --- */
.highlight-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(var(--success-rgb), 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(var(--warning-rgb), 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(var(--danger-rgb), 0.15);
    color: var(--danger);
}

.badge-outline {
    box-shadow: inset 0 0 0 1px var(--border-color);
    color: var(--text-muted);
}

/* --- Components: Cards --- */
.card {
    background: var(--bg-surface-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-main);
}

/* --- Components: Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    /* Reset default browser style */
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.6);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--success-rgb), 0.4);
}

.btn-success:hover {
    box-shadow: 0 6px 16px rgba(var(--success-rgb), 0.6);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--text-muted);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
}

.btn-icon {
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* Loading State */
.btn-loading {
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 1.2em;
    height: 1.2em;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    color: white;
    /* Default loader color */
}

/* --- Components: Forms --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--duration-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
    background: var(--bg-surface);
}

.form-control::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* --- Components: Navbar --- */
.navbar {
    background: var(--bg-navbar);
    /* Matches bg-body with opacity */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-main);
}

.brand-logo {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.4));
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.75rem;
    width: 240px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all var(--duration-fast) var(--ease-out);
    z-index: 50;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: background var(--duration-fast);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    /* Works for dark & light */
    color: var(--primary-light);
}

.dropdown-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* --- Components: Toast/Alerts --- */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid transparent;
    animation: slideDown 0.4s var(--ease-out);
}

.alert-success {
    background: rgba(var(--success-rgb), 0.1);
    border-color: rgba(var(--success-rgb), 0.2);
    color: var(--success);
}

.alert-error,
.alert-danger {
    background: rgba(var(--danger-rgb), 0.1);
    border-color: rgba(var(--danger-rgb), 0.2);
    color: var(--danger);
}

.alert-info {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.2);
    color: var(--primary-light);
}

.alert-warning {
    background: rgba(var(--warning-rgb), 0.1);
    border-color: rgba(var(--warning-rgb), 0.2);
    color: var(--warning);
}

/* --- Tables --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    /* mask-image: linear-gradient(to right, black 95%, transparent 100%); */
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

th {
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Utilities --- */
.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.w-full {
    width: 100%;
}

.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .navbar-inner {
        padding: 0 1rem;
    }

    .desktop-only {
        display: none !important;
    }

    #mobileToggle {
        display: inline-flex !important;
    }
}

/* --- Mobile Menu Overlay --- */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-body);
    z-index: 200;
    padding: 1rem;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease-out);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.mobile-nav-link {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}


/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* --- Added Utilities --- */
.bg-surface-secondary {
    background-color: var(--bg-surface-secondary);
}

.bg-surface {
    background-color: var(--bg-surface);
}

.bg-primary-soft {
    background-color: rgba(var(--primary-rgb), 0.1);
}

.text-primary {
    color: var(--primary-light);
}

.text-danger {
    color: var(--danger);
}

.bg-danger-soft {
    background-color: rgba(var(--danger-rgb), 0.1);
}

.border-danger-subtle {
    border-color: rgba(var(--danger-rgb), 0.2);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.font-bold {
    font-weight: 700;
}

.text-dim {
    color: var(--text-dim);
}

.position-relative {
    position: relative;
}

/* --- Footer --- */
.app-footer {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
    /* Ensure it blends with body */
    margin-top: auto;
}

.footer-link {
    color: var(--primary-light);
    font-weight: 500;
}

/* --- WhatsApp Float --- */
.whatsapp-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #25D366;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 16px rgba(37, 211, 102, 0.6);
    color: white;
}

.whatsapp-icon {
    width: 28px;
    height: 28px;
}

/* Custom Tooltip */
.whatsapp-float::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: var(--bg-elevated);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease-out;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    visibility: hidden;
}

.whatsapp-float:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    visibility: visible;
}