/**
 * Home Page Styles
 * Main dashboard with stats and service links
 */

/* ============================================================================
   CONTAINER
   ============================================================================ */

.home-container {
    padding: 1rem 1rem 6rem 1rem;
    max-width: 800px;
    margin: 0 auto;
    background: var(--background-color);
    min-height: 100vh;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.home-header {
    text-align: center;
    padding: 2rem 0 1.5rem 0;
}

.home-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
}

.home-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ============================================================================
   STATS SUMMARY
   ============================================================================ */

.stats-summary {
    margin-bottom: 2rem;
}

.stats-table {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Metrics Loading State */
.metrics-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--card-background);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.metrics-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.metrics-loading span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Metrics Unavailable State */
.metrics-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--card-background);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.metrics-unavailable-icon {
    font-size: 2rem;
    opacity: 0.3;
}

.metrics-unavailable-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

/* Metrics Carousel */
.metrics-carousel {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.carousel-nav-btn {
    background: var(--hover-background);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-nav-btn:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.carousel-nav-btn:active {
    transform: scale(0.95);
}

.carousel-nav-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}

.carousel-nav-btn:hover img {
    opacity: 1;
}

.carousel-indicators {
    display: flex;
    gap: 0.5rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.indicator.active {
    background: var(--primary-color);
    width: 24px;
    border-radius: 4px;
}

.carousel-slides {
    position: relative;
    overflow: hidden;
}

.carousel-slide {
    display: none;
}

.carousel-slide.active {
    display: block;
}

.metric-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 1rem 0;
}

.metric-table {
    overflow-x: auto;
}

.metric-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.metric-table th {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.metric-table th:first-child {
    text-align: left;
}

.metric-table th.today-header {
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    border-radius: 4px;
}

.metric-table td {
    padding: 0.625rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

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

.metric-table .row-label {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-table tbody td:not(.row-label) {
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    color: var(--primary-color);
    font-weight: 500;
}

/* Preview values (last week's data shown for future days) */
.metric-table tbody td.preview-value {
    color: var(--text-tertiary);
    opacity: 0.6;
    font-style: italic;
}

/* Performance indicators (This Week vs Avg Last 12) */
.metric-table tbody td.performance-good {
    color: var(--success-color);
    font-weight: 700;
}

.metric-table tbody td.performance-bad {
    color: var(--danger-color);
    font-weight: 700;
}

/* ============================================================================
   SERVICE PANELS
   ============================================================================ */

.service-panels {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.service-panel {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    cursor: pointer;
}

/* Active panel (clickable link) */
a.service-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

a.service-panel:active {
    transform: translateY(0);
}

/* Disabled panel (placeholder) */
.service-panel.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--hover-background);
}

/* ============================================================================
   PANEL CONTENTS
   ============================================================================ */

.panel-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: 10px;
    padding: 0.75rem;
}

.panel-icon img {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1);
}

.service-panel.disabled .panel-icon {
    background: var(--text-tertiary);
}

.panel-content {
    flex: 1;
    min-width: 0;
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.panel-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.panel-arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    opacity: 0.4;
}

.panel-arrow img {
    width: 100%;
    height: 100%;
}

a.service-panel:hover .panel-arrow {
    opacity: 1;
    transform: translateX(4px);
    transition: all 0.2s ease;
}

.panel-badge {
    flex-shrink: 0;
    background: var(--text-tertiary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

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

@media (max-width: 768px) {
    .home-container {
        padding: 0.75rem 0.75rem 6rem 0.75rem;
    }

    .home-title {
        font-size: 1.75rem;
    }

    .home-subtitle {
        font-size: 0.9375rem;
    }

    .metrics-carousel {
        padding: 1rem;
    }

    .metric-title {
        font-size: 1rem;
    }

    .metric-table table {
        font-size: 0.8125rem;
    }

    .metric-table th,
    .metric-table td {
        padding: 0.5rem 0.375rem;
    }

    .service-panel {
        padding: 1rem 0.875rem;
    }

    .panel-icon {
        width: 42px;
        height: 42px;
    }

    .panel-title {
        font-size: 0.9375rem;
    }

    .panel-description {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .home-header {
        padding: 1.5rem 0 1rem 0;
    }

    .home-title {
        font-size: 1.5rem;
    }

    .metrics-carousel {
        padding: 0.875rem;
    }

    .metric-title {
        font-size: 0.9375rem;
        margin-bottom: 0.75rem;
    }

    .metric-table table {
        font-size: 0.75rem;
    }

    .metric-table th,
    .metric-table td {
        padding: 0.5rem 0.25rem;
    }

    .carousel-nav-btn {
        width: 32px;
        height: 32px;
    }

    .carousel-nav-btn img {
        width: 18px;
        height: 18px;
    }

    .panel-icon {
        width: 40px;
        height: 40px;
    }
}

/* ============================================================================
   DARK MODE SUPPORT (for future)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    /* Will be added when dark mode is implemented */
}
