/* ==========================================================================
   TABLET DASHBOARD - PREMIUM GLASSMORPHIC DESIGN SYSTEM
   Optimized for Fullscreen Landscape Tablet Kiosk Displays (100vh, Non-Scrollable)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@200;300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
    --bg-gradient: radial-gradient(circle at 50% 0%, #0d1527 0%, #030712 100%);
    --panel-glass: rgba(17, 24, 39, 0.6);
    --card-glass: rgba(30, 41, 59, 0.35);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glass-active: rgba(99, 102, 241, 0.3);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Semantic Colors */
    --primary: #6366f1; /* Indigo glow */
    --primary-light: rgba(99, 102, 241, 0.15);
    --success: #10b981; /* Emerald green */
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b; /* Amber */
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #ef4444; /* Rose */
    --danger-light: rgba(239, 68, 68, 0.12);
    
    /* Transitions */
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Global Resets & Layout --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: var(--transition-smooth);
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden; /* Avoid scrolling in Kiosk mode */
    display: flex;
    flex-direction: column;
    padding: 16px;
    -webkit-font-smoothing: antialiased;
}

/* Base Utility Classes */
.text-muted {
    color: var(--text-secondary) !important;
}

/* Custom Scrollbar for list scroll areas */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Burn-In Prevention Shift --- */
@keyframes pixelShift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(2px, -1px); }
    50% { transform: translate(1px, 2px); }
    75% { transform: translate(-1px, 1px); }
    100% { transform: translate(0, 0); }
}

.dashboard-root-grid {
    animation: pixelShift 300s infinite linear;
    height: 100%;
}

/* --- Layout Grid System --- */
.dashboard-container {
    display: grid;
    grid-template-columns: 32% 1fr;
    gap: 16px;
    height: calc(100vh - 56px); /* Leave room for status bar */
}

/* Left Sidebar Control Center */
.control-sidebar {
    background: var(--panel-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    height: 100%;
}

/* Right Widgets Grid (2x2) */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 16px;
    height: 100%;
}

/* Glass Cards */
.glass-card {
    background: var(--card-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
}

.glass-card:hover {
    border-color: var(--border-glass-active);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.1);
}

.glass-card .card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.glass-card .card-title i {
    color: var(--primary);
    font-size: 1rem;
    margin-right: 8px;
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.5));
}

.glass-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: calc(100% - 32px);
}

/* --- Clock Widget Styles --- */
.clock-display-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

.clock-display-panel .time-number {
    font-family: 'Outfit', sans-serif;
    font-size: 7rem;
    font-weight: 200;
    color: var(--text-primary);
    line-height: 0.9;
    letter-spacing: -2px;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.15));
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.clock-display-panel .date-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 10px;
    letter-spacing: 0.5px;
}

/* --- Sidebar Weather Info --- */
.sidebar-weather {
    border-top: 1px solid var(--border-glass);
    padding-top: 20px;
    margin-top: 20px;
}

.sidebar-weather-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-temp {
    font-family: 'Outfit', sans-serif;
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.sidebar-desc {
    font-size: 0.95rem;
    text-transform: capitalize;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sidebar-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

/* --- Train Widget Styles --- */
.train-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    justify-content: space-around;
}

.train-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 12px 16px;
}

/* Prominent Next Train Highlight */
.train-item.next-train-highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.03) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.05);
}

.train-time-group {
    display: flex;
    flex-direction: column;
}

.train-minutes-countdown {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
}

.train-minutes-countdown.text-danger {
    color: var(--danger) !important;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
.train-minutes-countdown.text-warning {
    color: var(--warning) !important;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}
.train-minutes-countdown.text-success {
    color: var(--success) !important;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.train-dest-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 2px;
}

.next-train-highlight .train-dest-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.train-meta-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.badge-glow {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-glow.bg-success {
    background-color: var(--success-light) !important;
    color: var(--success) !important;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-glow.bg-warning {
    background-color: var(--warning-light) !important;
    color: var(--warning) !important;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-glow.bg-danger {
    background-color: var(--danger-light) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.train-scheduled-hour {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Weather (Rain) Widget Styles --- */
.weather-main-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 16px;
    height: 100%;
}

.weather-stats-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.weather-pill-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.weather-pill-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-pill-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.weather-pill-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Rain Alert Bar */
.weather-rain-indicator-bar {
    border-radius: 14px;
    padding: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.weather-rain-indicator-bar.bg-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.05) 100%) !important;
    color: var(--success) !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.weather-rain-indicator-bar.bg-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.05) 100%) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Rain chart container */
.rain-chart-wrapper {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.chart-title-sub {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 6px;
}

/* --- Petrol Price Widget Styles --- */
.petrol-main-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 16px;
    height: 100%;
}

.petrol-price-summary {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.petrol-big-price-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 12px;
    text-align: center;
}

.petrol-current-cents {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.petrol-cents-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.petrol-meta-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Petrol Stats pills */
.petrol-stats-pill-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.petrol-stat-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.015);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.petrol-stat-label {
    color: var(--text-secondary);
}

.petrol-stat-val {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.petrol-stat-val.text-success {
    color: var(--success) !important;
}

.petrol-stat-val.text-danger {
    color: var(--danger) !important;
}

.petrol-trend-badge {
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.petrol-trend-badge.bg-success {
    background-color: var(--success-light) !important;
    color: var(--success) !important;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.petrol-trend-badge.bg-danger {
    background-color: var(--danger-light) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.petrol-trend-badge.bg-secondary {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
}

.petrol-chart-wrapper {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/* Monday Temperature widget style */
.monday-night-forecast-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.monday-main-temp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.monday-temp-big {
    font-family: 'Outfit', sans-serif;
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.monday-temp-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.15));
}

.monday-temp-desc-meta {
    font-size: 0.85rem;
    text-transform: capitalize;
    color: var(--text-secondary);
}

.monday-hourly-scroller {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.monday-hourly-card {
    min-width: 68px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 6px;
    text-align: center;
}

.monday-hourly-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.monday-hourly-icon {
    font-size: 1.25rem;
    margin: 4px 0;
}

.monday-hourly-temp-val {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
}

/* --- Status bar Footer --- */
.status-bar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 10px 20px;
    height: 40px;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-indicator-pill {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot-pulse.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulseGlow 2s infinite;
}

.status-dot-pulse.offline {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes pulseGlow {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.refresh-action-button {
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 4px 12px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-action-button:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.refresh-action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Spinner border */
.spinner-border-mini {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinnerRotate 0.75s linear infinite;
    display: inline-block;
}

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

/* --- Mobile / Portrait Adaptations --- */
@media (max-width: 991px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .dashboard-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .control-sidebar {
        height: auto;
        gap: 16px;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    
    .glass-card {
        height: auto;
        min-height: 250px;
    }
    
    .status-bar-footer {
        margin-top: 16px;
        margin-bottom: 16px;
    }
    
    .clock-display-panel .time-number {
        font-size: 5rem;
    }
}
