/* ========================================
   Custom Styles for Uhuru Report System
   ======================================== */

:root {
    --primary-color: #1e3c72;
    --secondary-color: #2a5298;
    --accent-color: #4a90e2;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --dark-bg: #2c3e50;
    --light-bg: #f8f9fa;
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

/* ========================================
   Layout Styles
   ======================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.wrapper {
    display: flex;
    min-height: 100vh;
    background: #f4f6f9;
}

/* ========================================
   Sidebar Styles
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 5px;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-wrapper {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.profile-image {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,0.3);
}

.sidebar .nav {
    padding: 20px 0;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 25px;
    margin: 4px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.sidebar .nav-link i {
    font-size: 1.2rem;
    width: 24px;
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.15);
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sidebar .nav-link.active i {
    color: var(--primary-color);
}

/* ========================================
   Main Content Area
   ======================================== */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f4f6f9;
    transition: var(--transition);
}

/* ========================================
   Navbar Styles
   ======================================== */

.navbar {
    padding: 15px 25px;
    border-radius: 0 0 20px 20px;
}

#sidebarToggle {
    color: var(--primary-color);
    padding: 8px;
    border-radius: 10px;
    transition: var(--transition);
}

#sidebarToggle:hover {
    background: rgba(0,0,0,0.05);
}

/* ========================================
   Card Styles
   ======================================== */

.stats-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stats-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.stats-icon i {
    font-size: 2rem;
    color: white;
}

.stats-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--dark-bg);
    margin-bottom: 5px;
}

.stats-label {
    color: #7f8c8d;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Table Styles
   ======================================== */

.table-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid #e9ecef;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 12px;
}

.table tbody td {
    padding: 15px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.status-draft {
    background: #e9ecef;
    color: #495057;
}

.status-submitted {
    background: #cfe2ff;
    color: #084298;
}

.status-reviewed {
    background: #d1e7dd;
    color: #0f5132;
}

.status-returned {
    background: #f8d7da;
    color: #842029;
}

/* Priority Badges */
.priority-low {
    background: #e9ecef;
    color: #495057;
}

.priority-medium {
    background: #fff3cd;
    color: #856404;
}

.priority-high {
    background: #f8d7da;
    color: #842029;
}

.priority-urgent {
    background: #dc3545;
    color: white;
}

/* ========================================
   Form Styles
   ======================================== */

.form-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    max-width: 900px;
    margin: 0 auto;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.form-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title i {
    color: var(--accent-color);
}

.form-label {
    font-weight: 500;
    color: var(--dark-bg);
    margin-bottom: 8px;
}

.form-control, .form-select {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 15px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: none;
}

/* ========================================
   Button Styles
   ======================================== */

.btn {
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--accent-color);
    color: white;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* ========================================
   KPI Dashboard Styles
   ======================================== */

.kpi-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.kpi-name {
    font-weight: 600;
    color: var(--primary-color);
}

.kpi-weight {
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.kpi-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
    margin: 15px 0;
}

.kpi-progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.kpi-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 1s ease;
}

/* ========================================
   Login Page Styles
   ======================================== */

.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-header .logo i {
    font-size: 3rem;
    color: white;
}

.login-header h2 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 10px;
}

.login-header p {
    color: #7f8c8d;
}

/* ========================================
   Alert Styles
   ======================================== */

.alert {
    border: none;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background: #f8d7da;
    color: #842029;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #cfe2ff;
    color: #084298;
}

/* ========================================
   Modal Styles
   ======================================== */

.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 20px 20px 0 0;
    padding: 20px 25px;
    border: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 20px 25px;
}

/* ========================================
   Loading Spinner
   ======================================== */

.spinner-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-wrapper.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.active {
        margin-left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.active {
        margin-left: var(--sidebar-width);
    }
    
    .stats-card {
        margin-bottom: 15px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .form-container {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .stats-value {
        font-size: 1.8rem;
    }
    
    .btn {
        padding: 10px 20px;
    }
    
    .login-card {
        padding: 30px 20px;
        margin: 20px;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .sidebar,
    .navbar,
    .footer,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Table styles */
.table th {
    white-space: nowrap;
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
}

.table td {
    vertical-align: middle;
}

.text-wrap {
    word-wrap: break-word;
    white-space: normal;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    min-width: 100px;
}

.status-pending { 
    background: #fff3cd; 
    color: #856404; 
}

.status-investigating { 
    background: #cfe2ff; 
    color: #084298; 
}

.status-resolved { 
    background: #d4edda; 
    color: #155724; 
}

.status-adjusted { 
    background: #d1ecf1; 
    color: #0c5460; 
}

.diff-positive { 
    color: #dc3545; 
    font-weight: bold;
}

.diff-negative { 
    color: #28a745; 
    font-weight: bold;
}

.diff-zero { 
    color: #6c757d; 
}

.diff-card {
    transition: background-color 0.2s ease;
}

.diff-card:hover {
    background-color: #f8f9fa;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
    }
    
    .table th, .table td {
        min-width: 120px;
    }
    
    .status-badge {
        min-width: 80px;
        font-size: 0.7rem;
    }
}