/* ============================================
   SIM-LAB - Custom Stylesheet
   Color Scheme: Orange Soft (#FF8A48)
   ============================================ */

:root {
    --orange-soft:   #FF8A48;
    --orange-light:  #FFF4ED;
    --orange-dark:   #E56D28;
    --text-dark:     #2D3748;
    --text-muted:    #718096;
    --bg-light:      #F8F9FA;
    --white:         #FFFFFF;
    --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:     0 4px 14px rgba(0,0,0,0.08);
    --shadow-lg:     0 8px 24px rgba(0,0,0,0.10);
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     14px;
    --sidebar-width: 255px;
    --navbar-height: 64px;
}

/* ==================== BASE ==================== */
* { box-sizing: border-box; }

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--orange-soft); text-decoration: none; }
a:hover { color: var(--orange-dark); text-decoration: none; }

/* ==================== LAYOUT ==================== */
.wrapper { display: flex; min-height: 100vh; }

#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--white);
    border-right: 1px solid #F0F0F0;
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

#sidebar.collapsed { width: 70px; }
#sidebar.collapsed .nav-link span,
#sidebar.collapsed .sidebar-brand-text,
#sidebar.collapsed .sidebar-section-title,
#sidebar.collapsed .user-info-text,
#sidebar.collapsed .arrow-icon { display: none; }
#sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
#sidebar.collapsed .nav-link i { margin: 0; font-size: 1.2rem; }
#sidebar.collapsed .sidebar-submenu { display: none !important; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    transition: margin-left 0.3s ease;
}
.main-content.expanded { margin-left: 70px; }

/* ==================== SIDEBAR BRAND ==================== */
.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #F5F5F5;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--navbar-height);
}

.sidebar-brand-logo {
    width: 38px;
    height: 38px;
    background: var(--orange-soft);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--orange-soft);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sidebar-brand-text small {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
}

/* ==================== SIDEBAR NAV ==================== */
.sidebar-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 20px 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-muted);
    border-radius: 0;
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--orange-light);
    color: var(--orange-soft);
}

.sidebar-nav .nav-link.active {
    background: var(--orange-light);
    color: var(--orange-soft);
    font-weight: 600;
    border-right: 3px solid var(--orange-soft);
}

.sidebar-nav .nav-link .arrow-icon {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.sidebar-nav .nav-link[aria-expanded="true"] .arrow-icon {
    transform: rotate(90deg);
}

.sidebar-submenu {
    background: #FAFAFA;
    border-left: 3px solid #F0F0F0;
    margin: 0 10px 5px 30px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-submenu .nav-link {
    padding: 7px 15px;
    font-size: 13px;
    color: var(--text-muted);
}

.sidebar-submenu .nav-link.active,
.sidebar-submenu .nav-link:hover {
    color: var(--orange-soft);
    background: var(--orange-light);
}

/* ==================== SIDEBAR USER ==================== */
.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid #F5F5F5;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--orange-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user .user-info-text .name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    line-height: 1.2;
}
.sidebar-user .user-info-text .role-badge {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================== TOPBAR ==================== */
.topbar {
    height: var(--navbar-height);
    background: var(--white);
    border-bottom: 1px solid #F0F0F0;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-toggle {
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.topbar-toggle:hover { background: var(--orange-light); color: var(--orange-soft); }

.topbar-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn-icon {
    background: none;
    border: 1px solid #E8E8E8;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.btn-icon:hover { border-color: var(--orange-soft); color: var(--orange-soft); }
.btn-icon .badge-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--orange-soft);
    border-radius: 50%;
    border: 2px solid white;
}

/* ==================== PAGE CONTENT ==================== */
.page-content { padding: 24px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h4 {
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    font-size: 1.25rem;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
}
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-muted); }

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.card-header {
    background: none;
    border-bottom: 1px solid #F5F5F5;
    padding: 16px 20px;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header i { color: var(--orange-soft); }
.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 20px;
    border-left: 5px solid var(--orange-soft);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.border-success { border-left-color: #38A169; }
.stat-card.border-info    { border-left-color: #3182CE; }
.stat-card.border-danger  { border-left-color: #E53E3E; }
.stat-card.border-warning { border-left-color: #ECC94B; }
.stat-card.border-purple  { border-left-color: #9F7AEA; }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.bg-orange  { background: var(--orange-light); color: var(--orange-soft); }
.stat-icon.bg-success { background: #F0FFF4; color: #38A169; }
.stat-icon.bg-info    { background: #EBF8FF; color: #3182CE; }
.stat-icon.bg-danger  { background: #FFF5F5; color: #E53E3E; }
.stat-icon.bg-warning { background: #FFFFF0; color: #D69E2E; }
.stat-icon.bg-purple  { background: #FAF5FF; color: #9F7AEA; }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== BUTTONS ==================== */
.btn-orange {
    background-color: var(--orange-soft);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 8px 18px;
    transition: all 0.2s ease;
}
.btn-orange:hover, .btn-orange:focus {
    background-color: var(--orange-dark);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(255, 138, 72, 0.4);
}

.btn-orange-outline {
    background: transparent;
    color: var(--orange-soft);
    border: 1.5px solid var(--orange-soft);
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 7px 18px;
    transition: all 0.2s;
}
.btn-orange-outline:hover {
    background: var(--orange-soft);
    color: white;
}

/* ==================== BADGES ==================== */
.badge-soft-orange {
    background-color: var(--orange-light);
    color: var(--orange-dark);
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.pulse-badge { animation: pulse-red 1.5s infinite; }
@keyframes pulse-red {
    0%   { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(229, 62, 62, 0); }
    100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0); }
}

/* ==================== TABLES ==================== */
.table { color: var(--text-dark); }
.table thead th {
    background: #FAFAFA;
    border-top: none;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 14px;
    white-space: nowrap;
}
.table td {
    padding: 12px 14px;
    vertical-align: middle;
    border-color: #F5F5F5;
    font-size: 13.5px;
}
.table tbody tr:hover { background: var(--orange-light); }
.table-row-overdue { background: #FFF5F5 !important; }

/* ==================== FORMS ==================== */
.form-control {
    border-color: #E2E8F0;
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    font-size: 14px;
    padding: 9px 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    border-color: var(--orange-soft);
    box-shadow: 0 0 0 3px rgba(255, 138, 72, 0.12);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.input-group-text {
    background: #F8F9FA;
    border-color: #E2E8F0;
    color: var(--text-muted);
}

/* ==================== LOGIN PAGE ==================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.login-left {
    background: linear-gradient(145deg, var(--orange-soft) 0%, var(--orange-dark) 100%);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: white;
}

.login-right {
    flex: 0 0 460px;
    max-width: 460px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

@media (max-width: 768px) {
    .login-left { display: none; }
    .login-right { flex: 1; max-width: 100%; padding: 32px 24px; }
}

/* ==================== CALENDAR ==================== */
.fc-toolbar-title { font-size: 1rem !important; font-weight: 700 !important; }
.fc-button-primary {
    background-color: var(--orange-soft) !important;
    border-color: var(--orange-soft) !important;
}
.fc-button-primary:hover { background-color: var(--orange-dark) !important; border-color: var(--orange-dark) !important; }
.fc-day-today { background: var(--orange-light) !important; }

/* ==================== STATUS TIMELINE ==================== */
.status-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    margin: 16px 0;
}

.timeline-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 100px;
}

.timeline-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.timeline-dot.done   { background: #38A169; color: white; }
.timeline-dot.active { background: var(--orange-soft); color: white; box-shadow: 0 0 0 4px var(--orange-light); }
.timeline-dot.pending { background: #E8E8E8; color: var(--text-muted); }

.timeline-line {
    flex: 1;
    height: 2px;
    background: #E8E8E8;
    min-width: 20px;
}
.timeline-line.done { background: #38A169; }

/* ==================== ALERTS ==================== */
.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 13.5px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 991px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.show {
        transform: translateX(0);
    }
    .main-content { margin-left: 0 !important; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }
    .sidebar-overlay.show { display: block; }
}

/* ==================== UTILITIES ==================== */
.text-orange { color: var(--orange-soft) !important; }
.bg-orange-light { background: var(--orange-light) !important; }
.border-orange { border-color: var(--orange-soft) !important; }
.shadow-card { box-shadow: var(--shadow-md) !important; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 5px 8px;
}
.page-item.active .page-link {
    background-color: var(--orange-soft);
    border-color: var(--orange-soft);
}
.page-link { color: var(--orange-soft); }

/* Image preview */
.img-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    border: 2px solid #E2E8F0;
    object-fit: cover;
}

/* QR Print styles */
@media print {
    .no-print { display: none !important; }
    .qr-label { page-break-inside: avoid; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange-soft); }
