/* IPH Forecasting Dashboard Styles */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #4facfe;
    --warning-color: #f093fb;
    --danger-color: #fa709a;
    --info-color: #00f2fe;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 0.75rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.3s ease;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    line-height: 1.6;
}

/* Sidebar Styles */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    z-index: 1000;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    margin: 0.25rem 0.5rem;
    padding: 0.75rem 1rem;
    transition: var(--transition);
    font-weight: 500;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    transform: translateX(5px);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: 100vh;
}

/* Card Styles */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    font-weight: 600;
}

/* Metric Cards */
.metric-card {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f5576c 100%);
    color: white;
    border: none;
}

.performance-card {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--info-color) 100%);
    color: white;
    border: none;
}

.alert-card {
    background: linear-gradient(135deg, var(--danger-color) 0%, #fee140 100%);
    color: white;
    border: none;
}

.info-card {
    background: linear-gradient(135deg, var(--info-color) 0%, var(--primary-color) 100%);
    color: white;
    border: none;
}

/* Button Styles */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
}

/* Chart Container */
.chart-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: var(--box-shadow);
    position: relative;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Table Styles */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(102, 126, 234, 0.1);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    background-color: rgba(102, 126, 234, 0.05);
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--secondary-color);
    background-color: rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
    border-color: var(--success-color);
    background-color: rgba(79, 172, 254, 0.1);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Indicators */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-success { background-color: #28a745; }
.status-warning { background-color: #ffc107; }
.status-danger { background-color: #dc3545; }
.status-info { background-color: #17a2b8; }

/* Progress Bars */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.1);
}

.progress-bar {
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success { border-left-color: #28a745; }
.alert-warning { border-left-color: #ffc107; }
.alert-danger { border-left-color: #dc3545; }
.alert-info { border-left-color: #17a2b8; }

/* Badges */
.badge {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Form Controls */
.form-control {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .metric-card .h4 {
        font-size: 1.5rem;
    }
}

/* Animation Classes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); }
.shadow { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); }

/* Print Styles */
@media print {
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Enhanced Dashboard Styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff !important;
    border-bottom: 1px solid #eee;
    border-radius: 12px 12px 0 0 !important;
}

/* Metric Cards Enhanced */
.metric-card, .performance-card, .alert-card, .info-card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.metric-card::before,
.performance-card::before,
.alert-card::before,
.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
}

/* Row spacing */
.g-4 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

/* Table enhancements */
.table > :not(caption) > * > * {
    padding: 1rem 1rem;
    border-bottom-width: 1px;
    border-color: #f0f0f0;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(102, 126, 234, 0.05);
}

/* Badge enhancements */
.badge {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Progress bar enhancements */
.progress {
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.05);
}

.progress-bar {
    border-radius: 10px;
}

/* Alert enhancements */
.alert {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Button enhancements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .h3 {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Text gradient enhancement */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Chart container improvements */
#forecastChart, #modelComparisonChart {
    border-radius: 0 0 12px 12px;
}

/* Border utilities */
.border-end {
    border-right: 1px solid #dee2e6 !important;
}

/* Custom spacing */
.py-3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

/* Shadow utilities */
.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Model Card Hover Effects */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Status Badge Improvements */
.badge {
    font-size: 0.75rem;
    padding: 0.5em 0.75em;
    border-radius: 0.5rem;
}

/* Progress Bar in Card Footer */
.progress {
    border-radius: 0;
}

.progress-bar {
    transition: width 0.6s ease;
}

.card .position-absolute .fa-crown {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}


.card-body h6,
.card-body strong,
.card-body .text-dark {
    color: #000000 !important;
}

.card-body small.text-muted {
    color: #6c757d !important;
}

.card .text-white {
    color: #000000 !important;
}

/* ✅ GRADIENT HEADERS */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
}

/* ✅ CARD HOVER EFFECT */
.card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15) !important;
}

/* ✅ TABLE STYLING */
#modelComparisonTable tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

#modelComparisonTable .table-success {
    background-color: #d1f2eb !important;
}

/* ==================== RESPONSIVE STYLES ==================== */

/* Mobile Responsive Tables */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Stack table on very small screens */
    @media (max-width: 576px) {
        .table-responsive table {
            display: block;
            width: 100%;
        }
        
        .table-responsive thead {
            display: none;
        }
        
        .table-responsive tbody,
        .table-responsive tr,
        .table-responsive td {
            display: block;
            width: 100%;
        }
        
        .table-responsive tr {
            border: 1px solid #dee2e6;
            margin-bottom: 1rem;
            border-radius: 0.5rem;
            padding: 0.5rem;
        }
        
        .table-responsive td {
            border: none;
            padding: 0.5rem;
            position: relative;
            padding-left: 50% !important;
            text-align: left;
        }
        
        .table-responsive td::before {
            content: attr(data-label);
            position: absolute;
            left: 0.5rem;
            width: 45%;
            padding-right: 1rem;
            white-space: nowrap;
            font-weight: bold;
            color: #495057;
        }
    }
}

/* Responsive Cards */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-title {
        font-size: 1rem !important;
    }
}

/* Responsive Grid Layout */
@media (max-width: 1200px) {
    .row.g-4 > [class*="col-"] {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .row.g-4 > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
}

/* Responsive Forms */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group .form-control,
    .input-group .btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }
}

/* Responsive Modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem !important;
    }
}

/* Responsive Navigation Tabs */
@media (max-width: 768px) {
    .nav-tabs {
        flex-wrap: wrap;
        border-bottom: 2px solid #dee2e6;
    }
    
    .nav-tabs .nav-item {
        flex: 1 1 auto;
        min-width: 33.333%;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    @media (max-width: 576px) {
        .nav-tabs .nav-item {
            flex: 1 1 50%;
            min-width: 50%;
        }
        
        .nav-tabs .nav-link {
            padding: 0.5rem;
            font-size: 0.75rem;
        }
        
        .nav-tabs .nav-link i {
            display: block;
            margin-bottom: 0.25rem;
        }
    }
}

/* Responsive Page Headers */
@media (max-width: 768px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn-toolbar {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-toolbar .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        font-size: 1.5rem !important;
        word-wrap: break-word;
    }
}

/* Responsive Charts */
@media (max-width: 768px) {
    .chart-container,
    #forecastChart,
    #performanceChart,
    [id*="chart"] {
        height: 300px !important;
        width: 100% !important;
    }
}

/* Responsive Badges */
@media (max-width: 576px) {
    .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Responsive Alerts */
@media (max-width: 768px) {
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

/* Responsive Dropdowns */
@media (max-width: 768px) {
    .dropdown-menu {
        width: 100%;
        max-width: calc(100vw - 2rem);
    }
}

/* Responsive Pagination */
@media (max-width: 576px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-item {
        margin: 0.25rem;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Prevent text overflow */
@media (max-width: 768px) {
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .text-truncate {
        max-width: 100%;
    }
}

/* Touch-friendly buttons */
@media (max-width: 768px) {
    .btn {
        min-height: 44px; /* iOS recommended touch target */
        padding: 0.5rem 1rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.75rem;
    }
}

/* Responsive Images */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Fix iOS input zoom */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important;
    }
}