/* 
 * Premium Design System 2.0 - Speed MK-Pay
 * Style: Deep Dark Glassmorphism
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Base Palette - Zinc/Slate Dark */
    --bg-app: #09090b;
    /* Ultra Dark */
    --bg-sidebar: #020202;
    --bg-card: rgba(22, 22, 24, 0.7);
    /* Translucent */
    --bg-card-hover: rgba(30, 30, 35, 0.85);

    /* Accents */
    --primary: #f97316;
    /* Orange 500 */
    --primary-glow: rgba(249, 115, 22, 0.4);
    --secondary: #10b981;
    /* Emerald 500 */
    --danger: #ef4444;
    /* Red 500 */
    --info: #3b82f6;
    /* Blue 500 */

    /* Typography */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    /* Borders & Effects */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 255, 255, 0.2);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(249, 115, 22, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.05), transparent 25%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Global Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
}

.content-scrollable {
    flex: 1;
    padding: 2rem;
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    /* Sticky for Desktop */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    padding: 0 0.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #ea580c);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(249, 115, 22, 0.1);
    color: var(--primary);
    border-color: rgba(249, 115, 22, 0.2);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.1);
}

/* --- Collapsed Sidebar (Desktop) --- */
body.sidebar-collapsed .sidebar {
    width: 80px;
    padding: 2rem 1rem;
}

body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .promo-card,
body.sidebar-collapsed .nav-dot {
    display: none;
    opacity: 0;
}

body.sidebar-collapsed .logo-container {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 14px 0;
}

body.sidebar-collapsed .nav-icon {
    margin: 0;
}

/* --- Header --- */
.top-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 40;
    /* Glass Effect only if needed, usually transparent looks cleaner if separate */
    backdrop-filter: blur(10px);
    border-bottom: var(--glass-border);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    /* Prevent shrinking in flex containers */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Components --- */
.card {
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    border-color: var(--border-focus);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #d97706);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    /* Prevent text wrapping */
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.input-glass {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
}

.input-glass:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.form-control {
    width: 100%;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: 0.2s;
    box-sizing: border-box;
    /* Critical for mobile */
}

.form-control:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}

select.form-control {
    appearance: none;
    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='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group-text {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 10;
}

.form-control.with-icon {
    padding-left: 40px;
}

/* --- Toggles --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    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: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* --- Utilities --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.text-gradient {
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* --- Responsive Grids --- */
.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* --- Mobile Responsiveness --- */
/* --- Mobile Responsiveness --- */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }
}

/* Mobile Toggle - Hidden by default on Desktop */
.mobile-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
}

.mobile-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        /* Off-canvas */
        width: 280px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-toggle-btn {
        display: flex;
        /* Show flex to center icon */
    }

    .mobile-close-btn {
        display: block;
    }

    .top-header {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        flex-wrap: nowrap;
        /* Prevent wrapping */
        gap: 10px;
    }

    .top-header h2 {
        font-size: 1.2rem !important;
        /* Smaller font on mobile */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content-scrollable {
        padding: 1.5rem;
    }

    .grid-responsive,
    .dashboard-grid,
    .dashboard-grid-3,
    .dashboard-grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* Fix Sidebar Z-Index */
    .sidebar {
        z-index: 1000 !important;
        background-color: var(--bg-sidebar);
        /* Ensure opacity */
    }

    /* Fix Developer Page Header on Mobile */
    .reveal h1 {
        font-size: 1.5rem !important;
        /* Smaller title */
        line-height: 1.2;
    }

    .reveal p {
        font-size: 0.9rem !important;
    }

    .reveal {
        padding: 1.5rem !important;
    }

    /* Hide sidebar content when collapsed if transform fails visually */
    .sidebar:not(.active) {
        visibility: hidden;
    }
}