/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

:root {
    --text: #1e293b;
    --text-light: #64748b;
    --border: #cbd5e1;
    --success: #2ecc71;
    --warning: #e67e22;
    --danger: #e74c3c;
}

.panel {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.panel-head {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.muted {
    color: var(--gray);
    font-size: 0.95rem;
}

.search-container {
    margin: 2rem 0;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

.prediction-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.prediction-card {
    flex: 1;
    min-width: 200px;
    padding: 1.25rem;
    border-radius: var(--radius);
    background: white;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.prediction-highlight {
    border-left: 4px solid var(--accent);
    background: linear-gradient(135deg, #fef6e6 0%, #fff9f0 100%);
}

.prediction-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prediction-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
    min-height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.stat-card {
    padding: 1.25rem;
    border-radius: var(--radius);
    background: white;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.legend-colour {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.legend-colour.danger {
    background-color: var(--danger);
}

.legend-colour.success {
    background-color: var(--success);
}

.legend-colour.warning {
    background-color: var(--warning);
}

.legend-item p {
    margin: 0;
    color: var(--dark);
    font-size: 0.9rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
    flex: 1;
}

.action-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-analytics {
    background: var(--accent);
    color: white;
}

.btn-analytics:hover {
    background: #ff8c00;
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: white;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.log-table th {
    background: var(--darker);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.log-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
}

.log-table tr:last-child td {
    border-bottom: none;
}

.log-table tr:hover {
    background: rgba(74, 111, 165, 0.03);
}

.type-1, .type-2 {
    background-color: rgba(231, 76, 60, 0.05);
}

.type-3 {
    background-color: rgba(46, 204, 113, 0.05);
}

.type-4, .type-5, .type-6 {
    background-color: rgba(230, 126, 34, 0.05);
}

.type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.type-1 .type-badge, .type-2 .type-badge {
    background-color: var(--danger);
    color: white;
}

.type-3 .type-badge {
    background-color: var(--success);
    color: white;
}

.type-4 .type-badge, .type-5 .type-badge, .type-6 .type-badge {
    background-color: var(--warning);
    color: white;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.edit-btn {
    background: var(--secondary);
    color: white;
}

.edit-btn:hover {
    background: #5a7cac;
}

.delete-btn {
    background: var(--danger);
    color: white;
}

.delete-btn:hover {
    background: #d62c1a;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.close-btn:hover {
    background: var(--gray-light);
    color: var(--dark);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.time-type-pair {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.time-type-pair .form-control {
    flex: 1;
}

.remove-pair-btn {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.remove-pair-btn:hover {
    background: #d62c1a;
}

.add-pair-btn {
    margin-top: 0.5rem;
}

.sample-data-notification {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.5s ease-out;
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
}

.notification-text strong {
    font-size: 1rem;
    display: block;
    margin-bottom: 0.25rem;
}

.notification-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.notification-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.analytics-card {
    background: var(--light);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}

.analytics-card h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-card h4 i {
    color: var(--accent);
}

.day-of-week-chart {
    display: flex;
    align-items: flex-end;
    height: 100px;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.day-bar {
    flex: 1;
    background: var(--secondary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
    min-height: 1px;
}

.day-bar.highlight {
    background: var(--accent);
}

.day-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light);
}

.time-of-day-chart {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 0.5rem;
}

.hour-cell {
    width: calc(100% / 12);
    height: 20px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    position: relative;
}

.hour-cell.active {
    background: var(--primary);
}

.hour-cell.peak {
    background: var(--accent);
    box-shadow: 0 0 0 1px white;
}

.flex-group {
    display: flex;
    gap: 10px;
}

.btn-full-width {
    width: 100%;
    margin-bottom: 10px;
}

.small-note {
    color: var(--gray);
    display: block;
    margin-top: 5px;
}

.bordered-top {
    border-top: 1px solid var(--gray-light);
    padding-top: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.large-modal {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-controls {
        flex-direction: column;
    }

    .action-controls {
        justify-content: stretch;
    }

    .action-controls .btn {
        flex: 1;
        min-width: 0;
    }

    .prediction-content {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .legend-grid {
        grid-template-columns: 1fr;
    }

    .notification-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .notification-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .notification-buttons .btn {
        flex: 1;
    }

    .log-table {
        font-size: 0.85rem;
    }

    .log-table th,
    .log-table td {
        padding: 0.75rem;
    }

    .time-type-pair {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }
}