/* ===== KIVO Main Styles ===== */

:root {
    --kivo-primary: #0d6efd;
    --kivo-dark: #212529;
    --sidebar-width: 260px;
}

/* ===== Layout ===== */
#wrapper {
    min-height: 100vh;
}

#sidebar-wrapper {
    transition: margin 0.25s ease-out;
    max-height: 100vh;
    overflow-y: auto;
}

#sidebar-wrapper.toggled {
    margin-left: -260px;
}

#page-content-wrapper {
    min-width: 0;
    width: 100%;
}

/* ===== Sidebar ===== */
.list-group-item-action {
    border: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.list-group-item-action:hover {
    background-color: #f8f9fa;
}

.list-group-item-action.active {
    background-color: #e9ecef;
    border-left-color: var(--kivo-primary);
    color: var(--kivo-primary);
    font-weight: 500;
}

.list-group-item-action.active .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar-heading {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ===== Cards & KPIs ===== */
.kpi-card {
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kpi-card.kpi-primary { border-left-color: var(--kivo-primary); }
.kpi-card.kpi-success { border-left-color: #198754; }
.kpi-card.kpi-warning { border-left-color: #ffc107; }
.kpi-card.kpi-danger { border-left-color: #dc3545; }
.kpi-card.kpi-info { border-left-color: #0dcaf0; }

.kpi-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.kpi-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Status badges ===== */
.status-badge {
    padding: 0.25em 0.75em;
    border-radius: 50rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pending { background-color: #fff3cd; color: #664d03; }
.status-in_progress { background-color: #cfe2ff; color: #084298; }
.status-paused { background-color: #e2e3e5; color: #41464b; }
.status-completed { background-color: #d1e7dd; color: #0f5132; }
.status-closed { background-color: #d6d8db; color: #383d41; }
.status-waiting_parts { background-color: #f8d7da; color: #842029; }
.status-pending_approval { background-color: #fff3cd; color: #664d03; }
.status-external_repair { background-color: #e0cffc; color: #4a236e; }

/* ===== Priority badges ===== */
.priority-low { background-color: #d1e7dd; color: #0f5132; }
.priority-normal { background-color: #cfe2ff; color: #084298; }
.priority-high { background-color: #fff3cd; color: #664d03; }
.priority-urgent { background-color: #ffc107; color: #664d03; }
.priority-critical { background-color: #dc3545; color: #fff; }

/* ===== Tables ===== */
.table-hover tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom-width: 2px;
    white-space: nowrap;
}

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

/* ===== Forms ===== */
.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* ===== Timeline / Activity Log ===== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dee2e6;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.65rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--kivo-primary);
    border: 2px solid #fff;
}

.timeline-item .timeline-time {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state > i {
    font-size: 4rem;
    color: #dee2e6;
}

.empty-state .btn i,
.empty-state a.btn i,
.empty-state button i {
    font-size: 1rem;
    color: inherit;
}

/* ===== Login page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}

.login-card {
    max-width: 400px;
    width: 100%;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo i {
    font-size: 3rem;
    color: var(--kivo-primary);
}

/* ===== Chart containers ===== */
.chart-container {
    position: relative;
    width: 100%;
    max-height: 300px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #sidebar-wrapper {
        position: fixed;
        z-index: 1000;
        height: 100vh;
        margin-left: -260px;
    }

    #sidebar-wrapper.toggled {
        margin-left: 0;
    }

    .kpi-number {
        font-size: 1.5rem;
    }
}

/* ===== Loading spinner (HTMX) ===== */
.htmx-request .spinner-border {
    display: inline-block;
}

.spinner-border {
    display: none;
}

/* ===== Detail page header ===== */
.detail-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

/* ===== Action buttons ===== */
.action-btn-group .btn {
    margin-right: 0.25rem;
}

/* ===== Tab navigation ===== */
.nav-tabs .nav-link {
    color: #495057;
}

.nav-tabs .nav-link.active {
    font-weight: 600;
}
