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

:root {
    --font-sans: 'Outfit', sans-serif;
    
    /* Elegant HSL Colors */
    --bg-base: 220 33% 97%;
    --bg-card: 0 0% 100%;
    
    --primary: 262 83% 58%;
    --primary-light: 262 83% 95%;
    --primary-dark: 262 83% 40%;
    
    --success: 142 76% 36%;
    --success-light: 142 76% 95%;
    --warning: 38 92% 50%;
    --warning-light: 38 92% 95%;
    --danger: 350 89% 60%;
    --danger-light: 350 89% 95%;
    --info: 200 95% 48%;
    --info-light: 200 95% 95%;
    
    --sidebar-bg: 224 47% 11%;
    --sidebar-text: 215 20% 65%;
    --sidebar-text-active: 0 0% 100%;
    --sidebar-bg-active: 262 83% 58%;
    
    --text-primary: 224 71% 4%;
    --text-secondary: 220 9% 46%;
    --text-muted: 220 9% 70%;
    
    --border-color: 220 13% 91%;
    
    /* Shadows & Transitions */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 15px rgba(139, 92, 246, 0.25);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: hsl(var(--bg-base));
    color: hsl(var(--text-primary));
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: hsl(var(--text-muted) / 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--text-secondary));
}

/* Authentication Page Styles */
.auth-wrapper {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgb(242, 235, 243) 0%, rgb(224, 228, 245) 90.1%);
    padding: 20px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 40px;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--info)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-logo p {
    color: hsl(var(--text-secondary));
    margin-top: 5px;
    font-size: 0.9rem;
}

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

/* Sidebar Layout */
.sidebar {
    width: 260px;
    background-color: hsl(var(--sidebar-bg));
    color: hsl(var(--sidebar-text));
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition-normal);
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid hsl(var(--sidebar-text) / 0.1);
}

.sidebar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: hsl(var(--sidebar-text-active));
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    color: hsl(var(--primary));
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.sidebar-item-label {
    padding: 8px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: hsl(var(--sidebar-text) / 0.4);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    color: hsl(var(--sidebar-text));
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-link:hover {
    background-color: hsl(var(--sidebar-text) / 0.05);
    color: hsl(var(--sidebar-text-active));
}

.sidebar-link.active {
    background-color: hsl(var(--sidebar-bg-active));
    color: hsl(var(--sidebar-text-active));
    box-shadow: 0 4px 12px hsl(var(--primary) / 0.3);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid hsl(var(--sidebar-text) / 0.1);
}

.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.user-info-sidebar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    color: hsl(var(--sidebar-text-active));
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-role {
    font-size: 0.75rem;
    color: hsl(var(--sidebar-text));
    text-transform: uppercase;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header Navbar */
.navbar {
    height: 70px;
    background-color: hsl(var(--bg-card));
    border-bottom: 1px solid hsl(var(--border-color));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: hsl(var(--text-primary));
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Main Content Wrapper */
.content-wrapper {
    padding: 30px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Core Dashboard Widgets (KPI Cards) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: hsl(var(--bg-card));
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid hsl(var(--border-color));
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-normal);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.kpi-icon-wrapper.primary {
    background-color: hsl(var(--primary-light));
    color: hsl(var(--primary));
}

.kpi-icon-wrapper.success {
    background-color: hsl(var(--success-light));
    color: hsl(var(--success));
}

.kpi-icon-wrapper.warning {
    background-color: hsl(var(--warning-light));
    color: hsl(var(--warning));
}

.kpi-icon-wrapper.danger {
    background-color: hsl(var(--danger-light));
    color: hsl(var(--danger));
}

.kpi-data h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: hsl(var(--text-secondary));
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.05em;
}

.kpi-data p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Standard Panels / Glassmorphism Cards */
.card {
    background-color: hsl(var(--bg-card));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid hsl(var(--border-color));
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid hsl(var(--border-color));
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: hsl(var(--text-primary));
}

.form-control {
    width: 100%;
    padding: 10px 16px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background-color: hsl(var(--bg-base) / 0.5);
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    color: hsl(var(--text-primary));
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--primary));
    background-color: hsl(var(--bg-card));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--text-muted));
}

.input-with-icon {
    padding-left: 45px;
}

/* Custom Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: hsl(var(--text-secondary));
}

.form-checkbox input {
    cursor: pointer;
}

/* Beautiful Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary) / 0.85));
    color: white;
    box-shadow: 0 4px 10px hsl(var(--primary) / 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 14px hsl(var(--primary) / 0.3), var(--shadow-glow);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: hsl(var(--bg-base));
    color: hsl(var(--text-primary));
    border: 1px solid hsl(var(--border-color));
}

.btn-secondary:hover {
    background-color: hsl(var(--border-color));
}

.btn-success {
    background-color: hsl(var(--success));
    color: white;
}

.btn-success:hover {
    background-color: hsl(var(--success-light) / 0.2);
    color: hsl(var(--success));
    border: 1px solid hsl(var(--success));
}

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

.btn-danger:hover {
    background-color: hsl(var(--danger-light) / 0.2);
    color: hsl(var(--danger));
    border: 1px solid hsl(var(--danger));
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* Modern Tables styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.table th {
    background-color: hsl(var(--bg-base) / 0.5);
    padding: 16px 20px;
    font-weight: 600;
    color: hsl(var(--text-secondary));
    border-bottom: 1px solid hsl(var(--border-color));
    white-space: nowrap;
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border-color));
    color: hsl(var(--text-primary));
    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background-color: hsl(var(--bg-base) / 0.25);
}

/* Dynamic Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* Status: Pelanggan */
.badge-aktif {
    background-color: hsl(var(--success-light));
    color: hsl(var(--success));
}

.badge-suspend {
    background-color: hsl(var(--warning-light));
    color: hsl(var(--warning));
}

.badge-putus, .badge-terminasi {
    background-color: hsl(var(--danger-light));
    color: hsl(var(--danger));
}

/* Status: Tagihan */
.badge-lunas {
    background-color: hsl(var(--success-light));
    color: hsl(var(--success));
}

.badge-sebagian {
    background-color: hsl(var(--warning-light));
    color: hsl(var(--warning));
}

.badge-belum-bayar {
    background-color: hsl(var(--danger-light));
    color: hsl(var(--danger));
}

/* Status: Pengerjaan / Konfirmasi */
.badge-pending {
    background-color: hsl(var(--warning-light));
    color: hsl(var(--warning));
}

.badge-proses {
    background-color: hsl(var(--info-light));
    color: hsl(var(--info));
}

.badge-selesai, .badge-disetujui {
    background-color: hsl(var(--success-light));
    color: hsl(var(--success));
}

.badge-ditolak {
    background-color: hsl(var(--danger-light));
    color: hsl(var(--danger));
}

/* Breadcrumbs & Header Actions */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-title h2 {
    font-size: 1.6rem;
    font-weight: 700;
}

.dashboard-title p {
    color: hsl(var(--text-secondary));
    font-size: 0.9rem;
    margin-top: 5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Alerts and Messages */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.alert-success {
    background-color: hsl(var(--success-light));
    color: hsl(var(--success));
    border: 1px solid hsl(var(--success) / 0.2);
}

.alert-danger {
    background-color: hsl(var(--danger-light));
    color: hsl(var(--danger));
    border: 1px solid hsl(var(--danger) / 0.2);
}

.alert-warning {
    background-color: hsl(var(--warning-light));
    color: hsl(var(--warning));
    border: 1px solid hsl(var(--warning) / 0.2);
}

/* Modal Popup Window */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-window {
    background-color: hsl(var(--bg-card));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid hsl(var(--border-color));
    width: 100%;
    max-width: 500px;
    transform: scale(0.95);
    transition: var(--transition-normal);
    overflow: hidden;
}

.modal-overlay.active .modal-window {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: hsl(var(--text-secondary));
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid hsl(var(--border-color));
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Grid helper utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Invoice Styling for Printing */
.invoice-container {
    background: hsl(var(--bg-card));
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid hsl(var(--border-color));
    max-width: 800px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid hsl(var(--border-color));
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.invoice-logo h2 {
    color: hsl(var(--primary));
    font-weight: 700;
}

.invoice-title-block {
    text-align: right;
}

.invoice-title-block h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.invoice-section-title {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: hsl(var(--text-secondary));
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.invoice-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
}

.invoice-summary-table th {
    border-bottom: 2px solid hsl(var(--border-color));
    padding: 12px 10px;
    font-weight: 600;
    color: hsl(var(--text-secondary));
}

.invoice-summary-table td {
    padding: 15px 10px;
    border-bottom: 1px solid hsl(var(--border-color));
}

.invoice-total-row td {
    font-weight: 700;
    font-size: 1.1rem;
    border-top: 2px solid hsl(var(--text-primary));
    border-bottom: none;
    padding-top: 20px;
}

.invoice-footer {
    border-top: 1px solid hsl(var(--border-color));
    padding-top: 20px;
    text-align: center;
    color: hsl(var(--text-secondary));
    font-size: 0.85rem;
}

/* Print CSS Media query */
@media print {
    body {
        background-color: white !important;
        color: black !important;
    }
    .sidebar, .navbar, .btn, .header-actions, .no-print {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .content-wrapper {
        padding: 0 !important;
    }
    .invoice-container {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .table th {
        background-color: #f1f5f9 !important;
        color: black !important;
        border-bottom: 2px solid #cbd5e1 !important;
    }
    .table td {
        border-bottom: 1px solid #e2e8f0 !important;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    .invoice-details-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Custom Pagination Styles */
.pagination {
    display: inline-flex;
    list-style: none;
    border-radius: var(--radius-md);
    padding: 0;
    margin-top: 20px;
    gap: 5px;
}

.pagination .page-item {
    display: inline;
}

.pagination .page-link, .pagination .page-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--border-color));
    background-color: hsl(var(--bg-card));
    color: hsl(var(--text-primary));
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.pagination .page-link:hover {
    background-color: hsl(var(--primary-light));
    border-color: hsl(var(--primary));
    color: hsl(var(--primary));
}

.pagination .page-item.active span, .pagination .page-item.active .page-link {
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: white;
}

.pagination .page-item.disabled span, .pagination .page-item.disabled .page-link {
    color: hsl(var(--text-muted));
    background-color: hsl(var(--bg-base) / 0.5);
    border-color: hsl(var(--border-color));
    cursor: not-allowed;
}

/* Dashboard Chart Grid Layout (70% - 30%) */
.chart-grid {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}
