/* ============================================
   COMPREHENSIVE SYSTEM UI/UX ENHANCEMENTS
   Make the system more user-friendly
   ============================================ */

/* ============ GENERAL IMPROVEMENTS ============ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============ BUTTONS & LINKS ============ */

.btn {
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(90deg, #5568d3 0%, #6a3a8a 100%);
    color: #fff;
}

.btn-success {
    background: #27ae60;
}

.btn-success:hover {
    background: #229954;
    color: #fff;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

.btn-warning {
    background: #f39c12;
}

.btn-warning:hover {
    background: #d68910;
    color: #fff;
}

.btn-info {
    background: #3498db;
}

.btn-info:hover {
    background: #2980b9;
    color: #fff;
}

a {
    color: #667eea;
    transition: color 0.2s ease;
}

a:hover {
    color: #764ba2;
    text-decoration: none;
}

/* ============ FORMS ============ */

.form-control {
    border-radius: 6px;
    border: 1px solid #d0d8ed;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.form-group {
    margin-bottom: 16px;
}

label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f8f9fa;
    color: #7f8c8d;
}

/* ============ PANELS & CARDS ============ */

.panel {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.panel:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.panel-heading {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 11px 11px 0 0;
    border: none;
    padding: 15px 20px;
}

.panel-heading .panel-title {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

.panel-body {
    padding: 20px;
    background: #fff;
}

.panel-primary {
    border: 1px solid #e0e6ed;
}

/* ============ TABLES ============ */

.table {
    font-size: 13px;
}

.table thead th {
    background: #f5f7fb;
    color: #2c3e50;
    font-weight: 700;
    border-bottom: 2px solid #d0d8ed;
    padding: 12px 8px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #eee;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody td {
    padding: 12px 8px;
    vertical-align: middle;
}

/* ============ ALERTS & NOTIFICATIONS ============ */

.alert {
    border-radius: 8px;
    border: none;
    border-left: 4px solid;
    padding: 15px;
    font-size: 14px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d4edda;
    border-left-color: #27ae60;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-left-color: #e74c3c;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-left-color: #f39c12;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-left-color: #3498db;
    color: #0c5460;
}

.alert strong {
    font-weight: 700;
}

/* ============ MODALS ============ */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 11px 11px 0 0;
    padding: 16px 20px;
}

.modal-header .modal-title {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.modal-header .close {
    color: #fff;
    opacity: 0.8;
}

.modal-header .close:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #e0e6ed;
    padding: 16px;
    border-radius: 0 0 11px 11px;
}

/* ============ NAVIGATION ============ */

.sidebar-menu {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
}

#main-menu li a {
    color: #ecf0f1;
    border-radius: 6px;
    margin: 0 8px 6px;
    padding: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

#main-menu li a:hover {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

#main-menu li.active > a {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#main-menu li a i {
    font-size: 18px;
    width: 20px;
}

/* ============ TILES & METRICS ============ */

.tile-stats {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tile-stats:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.tile-stats .icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.tile-stats .num {
    font-size: 32px;
    font-weight: 700;
    margin: 8px 0;
}

.tile-stats h3 {
    margin: 8px 0;
    font-size: 14px;
    font-weight: 600;
}

.tile-cyan { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); }
.tile-red { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.tile-blue { background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%); }
.tile-green { background: linear-gradient(135deg, #27ae60 0%, #229954 100%); }
.tile-purple { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); }
.tile-black { background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%); }
.tile-brown { background: linear-gradient(135deg, #d68910 0%, #ba4a00 100%); }
.tile-pink { background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%); }
.tile-aqua { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); }

/* ============ BADGES ============ */

.badge {
    border-radius: 12px;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 11px;
}

.label {
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 600;
    font-size: 12px;
}

.label-default {
    background: #ecf0f1;
    color: #7f8c8d;
}

.label-success {
    background: #27ae60;
    color: #fff;
}

.label-danger {
    background: #e74c3c;
    color: #fff;
}

.label-warning {
    background: #f39c12;
    color: #fff;
}

.label-info {
    background: #3498db;
    color: #fff;
}

/* ============ RESPONSIVE IMPROVEMENTS ============ */

@media (max-width: 768px) {
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .panel-body {
        padding: 12px;
    }

    .table {
        font-size: 12px;
    }

    .table thead th,
    .table tbody td {
        padding: 8px 4px;
    }

    #main-menu li a {
        padding: 10px;
        margin: 0 6px 4px;
    }

    .tile-stats {
        padding: 16px 12px;
        margin-bottom: 12px;
    }

    .tile-stats .num {
        font-size: 24px;
    }

    .tile-stats .icon {
        font-size: 28px;
    }
}

/* ============ UTILITY CLASSES ============ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #7f8c8d;
}

.text-success {
    color: #27ae60;
}

.text-danger {
    color: #e74c3c;
}

.text-warning {
    color: #f39c12;
}

.text-info {
    color: #3498db;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-20 {
    padding: 20px;
}

/* ============ LOADING & TRANSITIONS ============ */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ ACCESSIBILITY IMPROVEMENTS ============ */

:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============ PRINT STYLES ============ */

@media print {
    .sidebar-menu,
    .navbar,
    .btn,
    .modal {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .panel,
    .table {
        box-shadow: none;
        border: 1px solid #999;
    }
}

/* ============ DROPDOWN MENU FIX ============ */
/* Bring dropdown menus to front and prevent clipping */

.btn-group,
.btn-group-vertical {
    position: relative;
}

.btn-group.open {
    z-index: 1000;
}

.dropdown-menu {
    z-index: 9999 !important;
    position: absolute !important;
    display: none;
}

.dropdown-menu.show,
.open .dropdown-menu {
    display: block !important;
    z-index: 9999 !important;
}

.btn-group.open .dropdown-menu {
    display: block !important;
    z-index: 9999 !important;
}

.dropup .dropdown-menu {
    z-index: 9999 !important;
    bottom: 100%;
    top: auto;
}

/* Ensure table cells don't clip dropdowns */
.table {
    position: relative;
    z-index: 1;
}

.table td {
    overflow: visible !important;
}

.table tbody tr {
    overflow: visible !important;
}

.datatable td {
    overflow: visible !important;
}

/* Table wrapper overflow fix */
.table-wrapper,
.datatable-wrapper {
    overflow: visible !important;
    position: relative !important;
}

/* Dropdown styling */
.dropdown-menu {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
    border-radius: 6px;
    border: 1px solid #e8ecef;
    background-color: #fff;
}

.dropdown-menu li a {
    padding: 10px 15px;
    transition: all 0.2s ease;
    display: block;
    color: #333;
}

.dropdown-menu li a:hover {
    background-color: #f5f6f7;
    color: #667eea;
}

.dropdown-menu li a i {
    margin-right: 8px;
}

/* Fix for table overflow hiding dropdown */
.dataTables_wrapper {
    overflow: visible !important;
    position: relative !important;
}

/* Modal fix — ensure modal and backdrop are always on top */
.modal {
    z-index: 10050 !important;
}

.modal-dialog {
    z-index: 10051 !important;
}

.modal-backdrop {
    z-index: 10049 !important;
}
