@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-card: #151c2c;
    --bg-hover: #1e293b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(99, 102, 241, 0.3);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --primary-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --shadow-card: 0 20px 35px -10px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.nav-item.active a {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--primary);
    color: white;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.75);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.topbar {
    height: 70px;
    background: rgba(21, 28, 44, 0.75);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.pwa-install-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.btn-logout {
    padding: 0.45rem 0.9rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* Content Area */
.content-body {
    padding: 2rem;
    flex: 1;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.25 ease, border-color 0.25s ease;
}

.card:hover {
    border-color: var(--border-color-glow);
    transform: translateY(-3px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.icon-purple { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.icon-orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.icon-red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.card-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
}

.card-subtext {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* Widgets Section Grid */
.widgets-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 270px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-body {
        padding: 1rem;
    }

    .widgets-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0 0.75rem;
    }

    .page-title {
        font-size: 1rem;
    }

    .user-profile {
        gap: 0.4rem;
    }

    .user-badge {
        display: none;
    }

    .pwa-install-btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }
}

.widget-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 1.05rem;
    font-weight: 700;
}

/* Table styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.data-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-primary { background: rgba(99, 102, 241, 0.2); color: var(--primary); }

/* ==========================================================================
   STUNNING CENTERING & MODERN DESIGN FOR LOGIN PAGE
   ========================================================================== */
.login-wrapper {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(ellipse at 80% 0%, rgba(99, 102, 241, 0.22) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 100%, rgba(168, 85, 247, 0.18) 0%, transparent 50%),
        #0b0f19;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Ambient Glowing Background Orbs */
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    filter: blur(140px);
    opacity: 0.25;
    top: 15%;
    left: 20%;
    border-radius: 50%;
    pointer-events: none;
}

.login-card {
    background: rgba(21, 28, 44, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 3rem 2.5rem;
    box-shadow: 
        0 30px 60px -15px rgba(0, 0, 0, 0.7),
        0 0 50px rgba(99, 102, 241, 0.15);
    position: relative;
    z-index: 10;
    animation: fadeInUp 0.5s ease-out;
}

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

.login-brand {
    text-align: center;
    margin-bottom: 2.25rem;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--primary-gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    margin: 0 auto 1rem auto;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 0.2px;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    background: rgba(11, 15, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.form-input:focus {
    background: rgba(11, 15, 25, 0.9);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

.btn-primary {
    width: 100%;
    padding: 0.95rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
    margin-top: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   MODAL DIALOG STYLES
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
    animation: fadeInModal 0.2s ease-out;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(99, 102, 241, 0.2);
    animation: slideUpModal 0.25s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* SweetAlert2 Modern Styling */
.swal2-popup {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-card) !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.swal2-title {
    font-weight: 800 !important;
    font-size: 1.25rem !important;
}

.swal2-styled {
    border-radius: var(--radius-sm) !important;
    font-weight: 700 !important;
    padding: 0.65rem 1.4rem !important;
}
