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

:root {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-shopee: #ee4d2d;
    --accent-tiktok: #0284c7;
    --accent-tiktok-alt: #e11d48;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #d946ef 100%);
    --accent-glow: rgba(79, 70, 229, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(226, 232, 240, 0.8);
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(238, 77, 45, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
}

/* ==========================================================================
   LOGIN PAGE STYLES (LIGHT THEME)
   ========================================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.login-glass-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    padding: 2.75rem 2.25rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    animation: cardAppear 0.6s ease-out forwards;
}

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

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

.brand-icon-wrapper {
    width: 68px;
    height: 68px;
    margin: 0 auto 1.25rem;
    background: var(--accent-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px var(--accent-glow);
}

.brand-icon-wrapper i {
    font-size: 2rem;
    color: #fff;
}

.login-brand h1 {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

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

.form-group-custom {
    margin-bottom: 1.25rem;
}

.form-group-custom label {
    display: block;
    font-size: 0.825rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.form-control-custom {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.85rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

.form-control-custom:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.form-control-custom:focus + i {
    color: #4f46e5;
}

.btn-primary-custom {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 8px 20px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
}

.security-badge {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 1px dashed #e2e8f0;
    padding-top: 1.25rem;
}

.security-badge i {
    color: #10b981;
}

/* ==========================================================================
   DASHBOARD LAYOUT STYLES (LIGHT THEME)
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

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

.sidebar-header .logo-box {
    width: 38px;
    height: 38px;
    background: var(--accent-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}

.sidebar-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.sidebar-menu {
    padding: 1.5rem 1rem;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-category {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 1.25rem 0.5rem 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: 10px;
    transition: var(--transition-fast);
    margin-bottom: 0.25rem;
}

.menu-item:hover {
    color: #4f46e5;
    background: #f1f5f9;
    transform: translateX(3px);
}

.menu-item.active {
    color: #ffffff;
    background: var(--accent-gradient);
    font-weight: 700;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.menu-item i {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: #64748b;
}

.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 2rem 2.5rem;
    width: calc(100% - 260px);
}

.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    background: #ffffff;
    transform: translateY(-3px);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

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

.stat-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.shopee {
    background: #fff1f0;
    color: var(--accent-shopee);
}

.stat-icon.tiktok {
    background: #f0f9ff;
    color: var(--accent-tiktok);
}

.stat-icon.total {
    background: #eef2ff;
    color: #4f46e5;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.stat-footer {
    font-size: 0.8rem;
    color: #059669;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

/* Custom Table Styles (Light Mode) */
.card-custom {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

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

.card-title-custom {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.table-responsive-custom {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

.table-custom th {
    text-align: left;
    padding: 1rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
    background: #f8fafc;
}

.table-custom td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-custom tr:hover td {
    background: #f8fafc;
}

.badge-status {
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.775rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.badge-shopee { background: #fff1f0; color: #ee4d2d; border: 1px solid #ffccc7; }
.badge-tiktok { background: #f0f9ff; color: #0284c7; border: 1px solid #bae6fd; }
.badge-success { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-warning { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.alert-custom {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.alert-danger-custom {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success-custom {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

/* Mobile Toggle & Backdrop Overlay */
.mobile-toggle-btn {
    display: none;
    background: #ffffff;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: #0f172a;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.mobile-toggle-btn:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .sidebar { width: 80px; }
    .sidebar-header h2, .menu-category, .menu-item span, .user-info { display: none; }
    .main-content { margin-left: 80px; width: calc(100% - 80px); padding: 1.5rem; }
    .menu-item { justify-content: center; padding: 0.85rem; }
}

@media (max-width: 768px) {
    .mobile-toggle-btn {
        display: inline-flex;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px !important;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header h2, .menu-category, .menu-item span, .user-info {
        display: block !important;
    }

    .menu-item {
        justify-content: flex-start !important;
        padding: 0.75rem 1rem !important;
    }

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

    .top-navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .header-title-container {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }

    .page-title h1 {
        font-size: 1.25rem !important;
        line-height: 1.3;
    }

    .page-title p {
        font-size: 0.8rem;
    }

    .header-right-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-custom {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    .card-header-custom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
}

/* Responsive Grid Utilities & Global Mobile Rules */
.grid-responsive-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .grid-responsive-2col {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Force all multi-column inline grids to stack into 1 clean column on mobile */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="minmax(450px"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .table-custom th, .table-custom td {
        padding: 0.65rem 0.5rem !important;
        font-size: 0.8rem !important;
    }

    .card-custom {
        padding: 0.85rem !important;
        border-radius: 14px !important;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding: 0 0.25rem;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #64748b;
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 700;
        gap: 0.25rem;
        flex: 1;
        height: 100%;
        transition: all 0.2s ease;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
    }

    .mobile-nav-item.active {
        color: #4f46e5;
    }

    .main-content {
        padding-bottom: 85px !important;
    }
}

/* Custom Modal Backdrop Overlay & Modal Card */
.custom-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-card-custom {
    width: 100%;
    max-width: 500px;
    background: #ffffff;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}
