@charset "UTF-8";

/* ==========================================================================
   FASE 7: PREMIUM THEME OVERRIDES (AdminLTE 3 / Bootstrap 4 -> Bootstrap 5 Style)
   ========================================================================== */

/* 1. TYPOGRAPHY & GLOBAL */
body, h1, h2, h3, h4, h5, h6, .brand-text {
    font-family: 'Inter', sans-serif !important;
}

body {
    background-color: #f0f9ff; /* Sky Blue background */
    color: #1e293b;
    animation: fadeIn 0.4s ease-in-out;
}

/* Custom Webkit Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9; 
}
::-webkit-scrollbar-thumb {
    background: #94a3b8; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b; 
}

/* Page Transition Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 2. SIDEBAR & NAVBAR */
.sidebar-dark-primary {
    background-color: #0f172a !important; /* Deep Navy Blue */
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.main-header {
    border-bottom: 2px solid #2563eb !important; /* Ocean Blue Accent */
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.nav-sidebar .nav-item > .nav-link {
    border-radius: 8px;
    margin: 2px 8px;
    transition: all 0.2s ease-in-out;
}

.nav-sidebar .nav-item > .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateX(4px);
}

.nav-sidebar .nav-link.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
    color: #fff !important;
}

/* 3. CARDS (Soft Shadows, Rounded) */
.card, .card-premium {
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: none !important;
    margin-bottom: 24px;
    background: #ffffff;
}

/* Override AdminLTE Card Variants */
.card-primary.card-outline, .card-info.card-outline, .card-success.card-outline, .card-warning.card-outline, .card-danger.card-outline {
    border-top: none !important;
}

.card-header {
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 1rem 1.25rem;
}

.card-primary:not(.card-outline) > .card-header,
.card-info:not(.card-outline) > .card-header,
.card-success:not(.card-outline) > .card-header,
.card-warning:not(.card-outline) > .card-header,
.card-danger:not(.card-outline) > .card-header {
    background-color: #ffffff !important;
    color: #1e293b !important;
}

.card-title {
    font-weight: 600;
    color: #1e293b !important;
}

/* 4. BUTTONS */
.btn {
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: #fff;
}

/* 5. FORMS */
.form-control {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.6rem 1rem;
    height: auto;
    color: #334155;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    background-color: #f8fafc;
}

label {
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.4rem;
}

/* 6. TABLES */
.table {
    color: #334155;
    margin-bottom: 0;
}

.table-bordered {
    border: 1px solid #f1f5f9;
}

.table-bordered th, .table-bordered td {
    border: 1px solid #f1f5f9;
}

.table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0 !important;
    border-top: none !important;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 12px;
}

.table tbody td {
    vertical-align: middle;
    padding: 12px;
}

.table-hover tbody tr:hover {
    background-color: #f0f9ff;
    transition: background-color 0.2s ease;
}

/* 7. DASHBOARD SMALL BOXES & GLOBAL BACKGROUNDS */
.bg-primary, .bg-primary.small-box, .bg-primary.info-box, .info-box-icon.bg-primary { 
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important; 
    color: #fff !important; 
}
.bg-info, .bg-info.small-box, .bg-info.info-box, .info-box-icon.bg-info { 
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important; 
    color: #fff !important; 
}
.bg-success, .bg-success.small-box, .bg-success.info-box, .info-box-icon.bg-success { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important; 
    color: #fff !important; 
}
.bg-warning, .bg-warning.small-box, .bg-warning.info-box, .info-box-icon.bg-warning { 
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important; 
    color: #fff !important; 
}
.bg-danger, .bg-danger.small-box, .bg-danger.info-box, .info-box-icon.bg-danger { 
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important; 
    color: #fff !important; 
}
.bg-navy, .bg-navy.small-box, .bg-navy.info-box, .info-box-icon.bg-navy { 
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important; 
    color: #fff !important; 
}

.small-box, .info-box {
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    position: relative;
    border: none;
    transition: all 0.3s ease;
}

.small-box:hover, .info-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.12);
}

.small-box .icon, .info-box .info-box-icon {
    opacity: 0.8;
    transition: all 0.3s;
}

.small-box:hover .icon, .info-box:hover .info-box-icon {
    transform: scale(1.1);
    opacity: 1;
}

.info-box-icon {
    border-radius: 12px 0 0 12px;
}

/* 8. MODALS */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.modal-title {
    font-weight: 600;
    color: #1e293b;
}

/* 9. SELECT2 (Match Bootstrap 5 style) */
.select2-container--bootstrap4 .select2-selection {
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    height: auto !important;
    padding: 0.3rem 0.5rem !important;
}

.select2-container--bootstrap4.select2-container--focus .select2-selection {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
}

/* 10. TIMELINE REKAM MEDIS */
.timeline::before {
    background-color: #e2e8f0;
}

.timeline > div > .timeline-item {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.timeline-header {
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
    color: #2563eb !important;
}

/* 11. PRINT STYLES (Invoice) */
@media print {
    body {
        background: #fff;
        color: #000;
    }
    .print-hide, .main-sidebar, .main-header, .btn {
        display: none !important;
    }
    .wrapper, .content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    .card {
        box-shadow: none !important;
        border: none !important;
    }
    .table-bordered th, .table-bordered td {
        border: 1px solid #000 !important;
    }
    .invoice-header-bg {
        background-color: #0f172a !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   FASE 9: MOBILE OPTIMIZATIONS (Responsive UI/UX)
   ========================================================================== */

@media (max-width: 767.98px) {
    /* 1. BOTTOM NAVIGATION BAR */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.08);
        z-index: 1040;
        height: 65px;
        align-items: center;
        justify-content: space-around;
        padding: 0 5px;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }
    .mobile-bottom-nav .nav-item {
        text-align: center;
        color: #64748b;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: all 0.2s;
        padding: 5px 0;
    }
    .mobile-bottom-nav .nav-item i {
        font-size: 1.3rem;
        margin-bottom: 3px;
    }
    .mobile-bottom-nav .nav-item span {
        font-size: 0.65rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .mobile-bottom-nav .nav-item.active {
        color: #2563eb;
    }
    .mobile-bottom-nav .nav-item.active i {
        transform: scale(1.15);
    }
    
    /* Make body pad bottom to avoid overlapping with bottom nav and sticky actions */
    body {
        padding-bottom: 80px !important;
    }
    
    /* 1.5. SIDEBAR OVERLAY */
    /* Add a dim overlay when sidebar is open on mobile */
    body.sidebar-open::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1038;
        animation: fadeIn 0.3s ease-in-out;
    }
    .main-sidebar {
        z-index: 1045 !important;
    }

    /* 2. HEADER/TOPBAR COMPRESSION */
    .main-header {
        padding: 0.2rem 0.5rem;
    }
    .main-header .navbar-nav .nav-item {
        margin: 0 !important;
    }
    .brand-text {
        font-size: 1rem !important; /* Smaller text on mobile header */
    }
    .main-header .nav-link {
        padding: 0.5rem !important;
    }

    /* 3. FORM INPUTS (Thumb-friendly) */
    .form-control, .select2-selection {
        height: 44px !important; /* Min touch target */
        font-size: 16px !important; /* Prevents iOS auto-zoom on inputs */
    }
    .btn {
        min-height: 44px; /* Touchable buttons */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* Stack form grids */
    .row > [class^="col-"] {
        margin-bottom: 15px;
    }

    /* 4. STICKY ACTIONS FOR FORMS */
    .mobile-sticky-action {
        position: fixed;
        bottom: 65px; /* Above bottom nav */
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
        padding: 10px 15px;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
        z-index: 1030;
        display: flex;
        gap: 10px;
        border-top: 1px solid #e2e8f0;
    }
    .mobile-sticky-action .btn {
        flex: 1;
        margin: 0;
    }
    /* Hide the original card-footer if sticky is active */
    .card-footer.has-sticky-action {
        display: none !important;
    }

    /* 5. TABLES TO CARDS */
    .table-responsive > .table {
        display: block;
        width: 100%;
        border: none !important;
    }
    .table-responsive > .table > thead {
        display: none; /* Hide headers */
    }
    .table-responsive > .table > tbody {
        display: block;
        width: 100%;
    }
    .table-responsive > .table > tbody > tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        margin-bottom: 15px;
        padding: 15px;
        border: 1px solid #f1f5f9;
        position: relative;
    }
    .table-responsive > .table > tbody > tr > td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none !important;
        padding: 8px 0;
        border-bottom: 1px dashed #e2e8f0 !important;
        text-align: right;
        min-height: 44px; /* Ensure rows are tappable/readable */
    }
    .table-responsive > .table > tbody > tr > td:last-child {
        border-bottom: none !important;
        justify-content: flex-end; /* Align actions to the right */
        flex-wrap: wrap; /* Wrap buttons if many */
        gap: 10px;
        padding-top: 15px;
    }
    /* If the table cell contains action buttons */
    .table-responsive > .table > tbody > tr > td:last-child::before {
        display: none; /* Usually actions don't need label */
    }
    .table-responsive > .table > tbody > tr > td .btn {
        margin: 2px 0;
    }
    /* Pseudo element to show column labels */
    .table-responsive > .table > tbody > tr > td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        text-align: left;
        margin-right: 15px;
        text-transform: uppercase;
        font-size: 0.75rem;
        flex: 1; /* Allow label to take space */
    }
    
    /* 6. DASHBOARD & WIDGETS */
    .small-box .icon {
        display: none; /* Hide huge icons on small screens to save space */
    }
    
    /* TIMELINE VERTICAL OPTIMIZATION */
    .timeline::before {
        left: 20px !important;
    }
    .timeline > div > .timeline-item {
        margin-left: 45px !important;
        margin-right: 0 !important;
    }
    .timeline > div > i {
        left: 5px !important;
    }
}

/* Hide mobile bottom nav on desktop */
@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }
    .card-footer.has-sticky-action {
        display: block !important;
    }
    .mobile-sticky-action {
        display: block !important; /* Ensure it is visible */
    }
    .mobile-sticky-action .btn.w-100 {
        width: auto !important;
        display: inline-block;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}
