/* =================================
   Lapas Pasuruan - Main Stylesheet
   ================================= */

/* Variables */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
}

.min-vh-75 {
    min-height: 75vh;
}

/* Background Gradient */
.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
}

/* ✅ PERBAIKAN: Bootstrap Background Color Override */
.bg-primary {
    background-color: var(--primary-color) !important;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
    color: #ffffff !important;
}

.bg-success {
    background-color: var(--success-color) !important;
    background: linear-gradient(135deg, var(--success-color) 0%, #146c43 100%) !important;
    color: #ffffff !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
    background: linear-gradient(135deg, var(--warning-color) 0%, #e0a800 100%) !important;
    color: #000000 !important;
}

.bg-info {
    background-color: var(--info-color) !important;
    background: linear-gradient(135deg, var(--info-color) 0%, #0aa2c0 100%) !important;
    color: #000000 !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
    background: linear-gradient(135deg, var(--danger-color) 0%, #b02a37 100%) !important;
    color: #ffffff !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #565e64 100%) !important;
    color: #ffffff !important;
}

.bg-dark {
    background-color: var(--dark-color) !important;
    background: linear-gradient(135deg, var(--dark-color) 0%, #121416 100%) !important;
    color: #ffffff !important;
}

/* Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

/* Icon Box */
.icon-box {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: transform 0.3s ease;
}

.card:hover .icon-box {
    transform: scale(1.1);
}

/* ✅ PERBAIKAN: Cards */
.card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ✅ PERBAIKAN UTAMA: Card Header Styling */
.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    padding: 1rem 1.5rem;
}

/* ✅ PERBAIKAN KHUSUS: Primary Header Override */
.card-header.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
    color: #ffffff !important;
    border-bottom: 2px solid #0a58ca !important;
}

.card-header.bg-primary h1,
.card-header.bg-primary h2,
.card-header.bg-primary h3,
.card-header.bg-primary h4,
.card-header.bg-primary h5,
.card-header.bg-primary h6 {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
    font-weight: 600 !important;
    margin-bottom: 0 !important;
}

.card-header.bg-primary i {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* Pastikan semua elemen dalam header primary berwarna putih */
.card-header.bg-primary * {
    color: #ffffff !important;
}

/* ✅ PERBAIKAN: Header Variants */
.card-header.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #146c43 100%) !important;
    color: #ffffff !important;
    border-bottom: 2px solid #146c43 !important;
}

.card-header.bg-success * {
    color: #ffffff !important;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #e0a800 100%) !important;
    color: #000000 !important;
    border-bottom: 2px solid #e0a800 !important;
}

.card-header.bg-warning * {
    color: #000000 !important;
}

.card-header.bg-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #b02a37 100%) !important;
    color: #ffffff !important;
    border-bottom: 2px solid #b02a37 !important;
}

.card-header.bg-danger * {
    color: #ffffff !important;
}

.card-header.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0aa2c0 100%) !important;
    color: #000000 !important;
    border-bottom: 2px solid #0aa2c0 !important;
}

.card-header.bg-info * {
    color: #000000 !important;
}

.card-header.bg-dark {
    background: linear-gradient(135deg, var(--dark-color) 0%, #121416 100%) !important;
    color: #ffffff !important;
    border-bottom: 2px solid #121416 !important;
}

.card-header.bg-dark * {
    color: #ffffff !important;
}

/* Navigation */
.navbar-brand {
    font-size: 1.5rem;
}

.nav-link {
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 0 2px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1rem;
}

.btn:hover {
    transform: translateY(-2px);
}

/* ✅ PERBAIKAN: Focus States */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

/* ✅ PERBAIKAN: Form Switch Customization */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Progress Steps */
.progress-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
    color: #6c757d;
    font-weight: 500;
}

.step.active {
    color: var(--primary-color);
}

.step.completed {
    color: var(--success-color);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: var(--primary-color);
    color: white;
}

.step.completed .step-number {
    background: var(--success-color);
    color: white;
}

.step:not(:last-child)::after {
    content: '';
    width: 50px;
    height: 2px;
    background: #e9ecef;
    margin: 0 15px;
    display: block;
}

.step.completed:not(:last-child)::after {
    background: var(--success-color);
}

/* ✅ PERBAIKAN: Progress Bar Improvements */
.progress {
    border-radius: 10px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* QR Code Container */
.qr-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 2px dashed var(--primary-color);
}

.qr-code {
    max-width: 200px;
    height: auto;
    margin: 0 auto;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .qr-container {
        border: 2px solid #000;
        page-break-inside: avoid;
    }
    
    .sidebar,
    .navbar,
    .btn,
    .modal,
    .alert,
    .no-print {
        display: none !important;
    }
    
    .col-md-9.ms-sm-auto.col-lg-10 {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .table {
        font-size: 12px;
    }
    
    .badge {
        border: 1px solid #000;
        color: #000 !important;
        background: transparent !important;
    }
}

/* DataTable Customizations */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_filter input {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 8px 12px;
}

.dataTables_length select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 4px 8px;
}

/* Alert Customizations */
.alert {
    border: none;
    border-radius: 12px;
    padding: 16px 20px;
    font-weight: 500;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    color: #055160;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #664d03;
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: #0f5132;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #58151c;
}

/* Modal Customizations */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px 16px 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0 0 16px 16px;
}

/* Badge Customizations */
.badge {
    font-size: 0.875em;
    padding: 6px 12px;
    border-radius: 6px;
}

/* ✅ PERBAIKAN UTAMA: SIDEBAR STYLES YANG KONSISTEN */
.sidebar {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border-right: 1px solid #dee2e6;
    min-height: calc(100vh - 56px);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar .nav-link {
    color: #495057;
    padding: 12px 20px;
    margin: 4px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-weight: 500;
    border: 1px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    border-color: rgba(13, 110, 253, 0.2);
    transform: translateX(3px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
    border-color: var(--primary-color);
}

.sidebar .nav-link.active:hover {
    background: linear-gradient(135deg, #0056b3 0%, var(--primary-color) 100%);
    transform: translateX(0);
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
}

/* ✅ TAMBAHAN: Sidebar Stats Section */
.sidebar-stats {
    border-top: 1px solid #dee2e6;
    margin-top: 20px;
    padding-top: 15px;
}

.sidebar-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    color: #6c757d;
}

.sidebar-stats .small {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-stats .small:last-child {
    border-bottom: none;
}

.sidebar-stats i {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
}

/* ✅ PERBAIKAN: Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        height: calc(100vh - 56px);
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
}

/* Status Badges */
.status-pending {
    background-color: #ffc107;
    color: #000;
}

.status-selesai {
    background-color: #198754;
    color: #fff;
}

.status-batal {
    background-color: #dc3545;
    color: #fff;
}

.status-aktif {
    background-color: #198754;
    color: #fff;
}

.status-non-aktif {
    background-color: #6c757d;
    color: #fff;
}

/* ✅ TAMBAHAN: Card Border Styles untuk Statistik */
.border-left-primary {
    border-left: 4px solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 4px solid var(--success-color) !important;
}

.border-left-info {
    border-left: 4px solid var(--info-color) !important;
}

.border-left-warning {
    border-left: 4px solid var(--warning-color) !important;
}

/* ✅ PERBAIKAN: Table Responsive */
.table-responsive {
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
    border-color: #f1f3f4;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ✅ TAMBAHAN: Button Group Improvements */
.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-outline-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ✅ PERBAIKAN: Loading Overlay */
#loadingOverlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* ✅ TAMBAHAN: Text Colors */
.text-gray-800 {
    color: #2d3436 !important;
}

.text-gray-300 {
    color: #ddd !important;
}

.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

/* ✅ PERBAIKAN: Opacity Utilities */
.opacity-50 {
    opacity: 0.5 !important;
}

/* ✅ TAMBAHAN: Card Statistics Improvements */
.card.text-white h4 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0;
}

.card.text-white p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.card.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
}

.card.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #146c43 100%) !important;
}

.card.bg-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #e0a800 100%) !important;
}

.card.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0aa2c0 100%) !important;
}

.card.bg-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #565e64 100%) !important;
}

.card.bg-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #b02a37 100%) !important;
}

/* ✅ PERBAIKAN: No Gutters Class */
.no-gutters {
    margin-right: 0;
    margin-left: 0;
}

.no-gutters > .col,
.no-gutters > [class*="col-"] {
    padding-right: 0;
    padding-left: 0;
}

/* ✅ TAMBAHAN: Transition Improvements */
* {
    transition: box-shadow 0.15s ease-in-out;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .progress-steps {
        flex-direction: column;
        align-items: center;
    }
    
    .step:not(:last-child)::after {
        width: 2px;
        height: 30px;
        margin: 10px 0;
    }
    
    .icon-box {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .sidebar-stats {
        margin-top: 15px;
        padding-top: 15px;
    }
    
    .card.text-white h4 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .sidebar .nav-link {
        padding: 10px 15px;
        margin: 2px 5px;
    }
    
    .sidebar .nav-link i {
        margin-right: 10px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Utility Classes */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.border-dashed {
    border-style: dashed !important;
}

.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
}