/* ============================================
   SUNRIZE STANDARD STYLES
   Common styling for all pages - compact, modern design
   Based on Settings page final design (Feb 2026)
   ============================================ */

/* ============================================
   BASE & LAYOUT
   ============================================ */
body {
    background-color: aliceblue;
    min-height: 100vh;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.body-container {
    margin-top: 4rem;
}

@media (min-width: 1400px) {
    .page-container {
        max-width: 1150px;
    }
}

/* ============================================
   PAGE HEADER (Compact)
   ============================================ */
.page-header {
    background: white;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #8080805c;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0 0 0.35rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-title i {
    color: #2d4380;
    font-size: 1.35rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================
   CARDS & PANELS (Compact)
   ============================================ */
.chart-card,
.settings-panel {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #8080805c;
    margin-bottom: 1.25rem;
}

/* ============================================
   CARD HEADERS (Compact)
   ============================================ */
.chart-header,
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.chart-title,
.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-title i,
.panel-title i {
    color: #667eea;
    font-size: 1rem;
}

/* ============================================
   STATS GRID (Compact)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #8080805c;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.65rem;
}

.stat-icon.blue {
    background: #2d4380;
    color: white;
}

.stat-icon.green {
    background: #28a745;
    color: white;
}

.stat-icon.orange {
    background: #ff740e;
    color: white;
}

.stat-icon.purple {
    background: #6f42c1;
    color: white;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0;
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.neutral {
    color: #6c757d;
}

/* ============================================
   FORM CONTROLS (Compact)
   ============================================ */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.75rem;
    font-weight: 500;
    color: #4b5563;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:hover:not(:disabled),
.form-select:hover {
    border-color: #2d4380;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #2d4380;
    box-shadow: 0 0 0 2px rgba(45, 67, 128, 0.1);
}

.form-control:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* ============================================
   BUTTONS (Compact)
   ============================================ */
.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary-modern {
    background: #2d4380;
    color: white;
    border-color: #2d4380;
}

.btn-primary-modern:hover {
    background: #1a2a52;
    border-color: #1a2a52;
}

.btn-secondary-modern,
.btn-outline-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.85rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-secondary-modern:hover,
.btn-outline-secondary:hover {
    background: #2d4380;
    border-color: #2d4380;
    color: white;
}

.btn-info-modern {
    background: #17a2b8;
    color: white;
}

.btn-info-modern:hover {
    background: #138496;
}

/* ============================================
   ALERTS (Compact)
   ============================================ */
.alert {
    border-radius: 8px;
    border: none;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-info {
    background-color: #e3efff;
    color: #2d4380;
}

.alert-info a {
    color: #1a2a52;
    font-weight: 600;
    text-decoration: none;
}

.alert-info a:hover {
    text-decoration: underline;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-danger a {
    color: #7f1d1d;
    font-weight: 600;
    text-decoration: none;
}

.alert-danger a:hover {
    text-decoration: underline;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* Fixed notification overlay */
#notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
    margin-bottom: 0;
}

.alert-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: #991b1b;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   TABLES (Compact)
   ============================================ */
.table {
    background: white;
    border: none;
    border-radius: 8px;
    overflow: hidden;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #f9fafb;
}

.table thead {
    background: #2d4380;
}

.table th {
    font-weight: 600;
    color: white;
    border: none;
    padding: 0.85rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.85rem;
    color: #4b5563;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.table tbody tr:hover {
    background-color: #f3f4f6;
}

/* ============================================
   CONTROLS BAR (Compact)
   ============================================ */
.controls-bar {
    background: white;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #8080805c;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.controls-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.range-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.range-pill {
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.85rem;
}

.range-pill:hover {
    background: #f9fafb;
    border-color: #2d4380;
}

.range-pill.active {
    background: #2d4380;
    color: white;
    border-color: #2d4380;
}

.selected-range-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #2d4380;
    color: white;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.selected-range-badge i {
    font-size: 0.9rem;
}

/* ============================================
   MODALS (Compact)
   ============================================ */
.modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0;
}

.modal-header {
    flex-direction: column;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 2px solid #e5e7eb;
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    border-radius: 8px 8px 0 0;
}

.modal-body {
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    max-height: 60vh;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.modal-footer .btn {
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 6px;
}

.modal-footer .btn-danger {
    background-color: #dc2626;
    border-color: #dc2626;
}

.modal-footer .btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.modal-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.modal-row:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* ============================================
   TOOLTIPS
   ============================================ */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d1d5db;
    color: #6b7280;
    font-size: 0.65rem;
    cursor: help;
    transition: all 0.2s ease;
    text-transform: none;
    font-weight: 700;
}

.info-tooltip:hover {
    background: #2d4380;
    color: white;
}

.tippy-box[data-theme~='sunrize'] {
    background-color: white;
    color: #2c3e50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.25rem;
    max-width: 300px !important;
    border: 1px solid #e9ecef;
}

.tippy-box[data-theme~='sunrize'] .tippy-content {
    padding: 0.75rem 1rem;
}

.tippy-box[data-theme~='sunrize'][data-placement^='top'] > .tippy-arrow::before {
    border-top-color: white;
}

.tippy-box[data-theme~='sunrize'] .tippy-arrow::after {
    content: '';
    position: absolute;
    z-index: -1;
    border-color: transparent;
    border-style: solid;
}

/* ============================================
   UTILITIES
   ============================================ */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem;
    color: #2d4380;
}

.spinner {
    border: 4px solid rgba(45, 67, 128, 0.1);
    border-top: 4px solid #2d4380;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 1s linear infinite;
}

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

@keyframes highlight-change {
    0% { background-color: white; }
    50% { background-color: rgba(45, 67, 128, 0.1); }
    100% { background-color: white; }
}

.highlight-change {
    animation: highlight-change 1s ease;
}

.no-data {
    text-align: center;
    color: #6c757d;
    padding: 1.5rem;
    font-style: italic;
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .page-title {
        font-size: 1.25rem;
    }
    
    .chart-card,
    .settings-panel {
        padding: 1rem;
    }
    
    .controls-bar {
        padding: 0.75rem;
    }
    
    .stat-card {
        padding: 0.85rem;
    }
}
