/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover-bg: #1e293b;
    --sidebar-active-bg: #4f46e5;
    
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --border-color: #e2e8f0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    background-color: #090d16;
    border-bottom: 1px solid #1e293b;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #a5b4fc, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar-menu li a:hover {
    color: #fff;
    background-color: var(--sidebar-hover-bg);
}

.sidebar-menu li.active a {
    color: #fff;
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--primary-light);
}

.sidebar-menu li a i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.main-content {
    padding: 30px;
    flex-grow: 1;
}

/* Cards & Containers (Glassmorphic touches) */
.card-stat {
    border: none;
    border-radius: 16px;
    padding: 24px;
    background: var(--bg-card);
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.1);
}

.card-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.card-stat.stat-success::before { background: var(--success); }
.card-stat.stat-warning::before { background: var(--warning); }
.card-stat.stat-danger::before { background: var(--danger); }
.card-stat.stat-info::before { background: var(--info); }

.stat-icon {
    font-size: 2.2rem;
    opacity: 0.85;
    background: #f1f5f9;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 8px;
    font-family: 'Outfit', sans-serif;
}

.card-main {
    border: none;
    border-radius: 16px;
    background-color: var(--bg-card);
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
    margin-bottom: 30px;
}

.card-main-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-main-body {
    padding: 24px;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-block;
}

.badge-open { background-color: #e0f2fe; color: #0369a1; }
.badge-assigned { background-color: #e0e7ff; color: #4338ca; }
.badge-rescheduled { background-color: #fef3c7; color: #b45309; }
.badge-attending { background-color: #fae8ff; color: #86198f; }
.badge-inprogress { background-color: #cffafe; color: #0891b2; }
.badge-spareparts { background-color: #ffedd5; color: #c2410c; }
.badge-resolved { background-color: #d1fae5; color: #047857; }
.badge-closed { background-color: #f1f5f9; color: #475569; }
.badge-cancelled { background-color: #fee2e2; color: #b91c1c; }

/* Timeline Custom Styles */
.ticket-timeline {
    position: relative;
    padding-left: 30px;
    list-style: none;
}

.ticket-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-marker {
    position: absolute;
    left: -30px;
    top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-content {
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    transition: all 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Custom Table Design */
.table-custom {
    width: 100% !important;
}

.table-custom th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
}

.table-custom td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

/* User Card */
.user-profile-badge {
    background-color: #f1f5f9;
    border-radius: 50px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

/* Fix DataTables Select Menu and layout formatting */
.dataTables_length select {
    width: auto !important;
    display: inline-block !important;
    padding: 0.375rem 1.75rem 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #212529 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    appearance: none !important;
    margin-right: 0.5rem !important;
    margin-left: 0.5rem !important;
}
.dataTables_filter input {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    margin-left: 0.5rem !important;
}
.dataTables_wrapper {
    padding: 10px 0 !important;
}

/* Action buttons expandable text on hover */
.btn-action-hover {
    display: inline-flex !important;
    align-items: center;
    overflow: hidden;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease, background-color 0.2s;
    max-width: 32px; /* Fits only the icon by default */
    white-space: nowrap;
    padding-left: 8px !important;
    padding-right: 8px !important;
    height: 32px;
    justify-content: center;
    border-radius: 50px !important;
}
.btn-action-hover:hover {
    max-width: 180px; /* Expands to show text */
    padding-left: 12px !important;
    padding-right: 12px !important;
}
.btn-action-hover span.action-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-width 0.3s ease, margin-left 0.3s ease;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-action-hover:hover span.action-text {
    opacity: 1;
    max-width: 120px;
    margin-left: 6px;
}

/* Global Print / PDF Document Rules */
@media print {
    @page {
        size: landscape;
        margin: 6mm 8mm;
    }
    body {
        zoom: 82%;
        transform: scale(0.85);
        transform-origin: top left;
        background: #fff !important;
        color: #000 !important;
    }
    .no-print, .no-print *, .status-comment-log, .status-comment-log * {
        display: none !important;
    }
    .card-main {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 1rem !important;
    }
    .tab-pane {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        margin-bottom: 1.5rem !important;
    }
    .table {
        font-size: 0.78rem !important;
        width: 100% !important;
    }
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        display: none !important;
    }
}


/* Badge contrast overrides for Bootswatch Zephyr */
.badge.bg-light,
.badge.bg-light-subtle,
.badge.bg-secondary-subtle,
.badge.text-secondary,
.badge.text-dark {
    color: #1e293b !important;
}

/* Select2 Form Consistency with Bootstrap 5 .form-control-sm / .form-select-sm */
.select2-container {
    width: 100% !important;
}
.select2-container--bootstrap-5 .select2-selection {
    min-height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    background-color: #fff !important;
}
.select2-container--bootstrap-5 .select2-selection--single {
    height: 36px !important;
    padding: 3px 8px !important;
    display: flex !important;
    align-items: center !important;
}
.select2-container .select2-selection--multiple,
.select2-container--bootstrap-5 .select2-selection--multiple,
.select2-container--default .select2-selection--multiple {
    min-height: 36px !important;
    max-height: 44px !important;
    overflow-y: auto !important;
    padding: 2px 6px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 3px !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background-color: #e0f2fe !important;
    border: 1px solid #bae6fd !important;
    color: #0369a1 !important;
    border-radius: 12px !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    margin: 1px 2px !important;
    padding: 1px 6px !important;
    display: inline-flex !important;
    align-items: center !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: #0284c7 !important;
    margin-right: 4px !important;
    font-weight: bold !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ef4444 !important;
}
.select2-container--bootstrap-5 .select2-search--inline {
    flex-grow: 1 !important;
    min-width: 100px !important;
    margin: 1px !important;
}
.select2-container--bootstrap-5 .select2-search--inline .select2-search__field {
    width: 100% !important;
    min-width: 100px !important;
    height: 26px !important;
    font-size: 0.85rem !important;
    padding: 2px 4px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #1e293b !important;
}

/* High-contrast Form Labels and Headers to prevent Zephyr text-secondary wash out */
.form-label,
label.form-label,
label,
.col-form-label {
    color: #1e293b !important;
    font-weight: 600;
}

.form-label.text-secondary,
label.text-secondary,
.text-secondary.fw-bold,
.text-secondary.small {
    color: #334155 !important;
}

.text-muted {
    color: #64748b !important;
}

.text-uppercase.fw-bold.text-muted {
    color: #475569 !important;
}

/* Comprehensive high-contrast fixes for Bootswatch Zephyr text-secondary wash out */
.text-secondary {
    color: #475569 !important;
}
.dropdown-header.text-secondary {
    color: #475569 !important;
}
.badge.text-secondary {
    color: #334155 !important;
}
.form-label,
label.form-label,
label,
.col-form-label {
    color: #0f172a !important;
    font-weight: 600 !important;
}
