/* KBLM Statistics Dashboard Styles */
/* Inheriting design from KBLM Flight Board */

body {
    font-family: Arial, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Header styles matching the flight board */
.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    padding: 30px 0 10px 0;
}

.widget-box {
    width: 200px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #23272b 80%, #3a4a5a 100%);
    border-radius: 14px;
    box-shadow: 0 0 16px 0 rgba(100, 149, 237, 0.27);
    border: 2px solid #b0c4de;
    font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'Consolas', monospace;
    color: #eaf6ff;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 1px;
    flex-shrink: 0;
    padding: 8px 16px;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.weather-widget,
.digital-clock {
    width: 200px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: none;
    border: none;
    box-shadow: none;
}

.header-container > .weather-widget {
    justify-self: start;
    margin-left: 40px;
}

.header-container > .clock-wrapper {
    justify-self: end;
    margin-right: 40px;
}

.clock-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 200px;
    box-sizing: border-box;
    padding: 0;
}

.logo-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    margin: 0 40px;
    text-align: center;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

.logo {
    max-height: 120px;
    height: 120px;
    animation: logoEffect 5s infinite alternate;
    transform-origin: center center;
}

.header {
    width: 100%;
    text-align: center;
}

.header h1 {
    font-size: 2.4em;
    font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'Consolas', monospace;
    color: #6ea0df;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

.weather-icon {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    filter: drop-shadow(0 0 6px rgba(100, 149, 237, 0.53)) invert(1) brightness(1.5);
}

.weather-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-temp {
    font-size: 1.2em;
    color: #b0c4de;
    font-weight: 700;
}

.weather-desc {
    font-size: 0.9em;
    color: #eaf6ff;
    opacity: 0.85;
}

.digital-clock {
    padding: 0;
    min-width: 0;
    text-align: center;
    background: none;
    border: none;
    box-shadow: none;
    text-shadow: 0 2px 8px #1a2a3a, 0 0 8px #6495ed;
}

.time-unit {
    font-weight: 700;
    letter-spacing: 1px;
}

.time-separator {
    opacity: 0.8;
    margin: 0 4px;
    transition: opacity 0.5s;
    font-size: 1.1em;
}

.time-period {
    font-size: 0.7em;
    margin-left: 8px;
    opacity: 0.85;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Logo animation */
@keyframes logoEffect {
    0% {
        opacity: 1;
        filter: brightness(1) contrast(1) drop-shadow(0 0 0px rgba(100, 180, 255, 0));
        transform: scale(1) rotate(0deg);
    }
    40% {
        opacity: 1;
        filter: brightness(1) contrast(1) drop-shadow(0 0 0px rgba(100, 180, 255, 0));
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.9;
        filter: brightness(1.3) contrast(1.1) drop-shadow(0 0 8px rgba(100, 180, 255, 0.7));
        transform: scale(1.05) rotate(2deg);
    }
    60% {
        opacity: 1;
        filter: brightness(1) contrast(1) drop-shadow(0 0 0px rgba(100, 180, 255, 0));
        transform: scale(1) rotate(0deg);
    }
    90% {
        opacity: 1;
        filter: brightness(1) contrast(1) drop-shadow(0 0 0px rgba(100, 180, 255, 0)); 
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0.9;
        filter: brightness(1.3) contrast(1.1) drop-shadow(0 0 8px rgba(100, 180, 255, 0.7));
        transform: scale(1.05) rotate(-2deg);
    }
}

/* Footer matching flight board */
.footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    color: #888;
    margin-top: 30px;
    padding: 0 40px 20px 40px;
    width: 100%;
    box-sizing: border-box;
}

/* Statistics specific styles */
.period-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.period-btn {
    background: linear-gradient(135deg, #23272b 80%, #3a4a5a 100%);
    border: 2px solid #b0c4de;
    border-radius: 8px;
    color: #eaf6ff;
    padding: 8px 16px;
    font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'Consolas', monospace;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 8px 0 rgba(100, 149, 237, 0.15);
}

.period-btn:hover {
    background: linear-gradient(135deg, #3a4a5a 80%, #23272b 100%);
    box-shadow: 0 0 16px 0 rgba(100, 149, 237, 0.35);
    transform: translateY(-2px);
}

.period-btn.active {
    background: linear-gradient(135deg, #6495ed 80%, #4169e1 100%);
    border-color: #87ceeb;
    box-shadow: 0 0 20px 0 rgba(100, 149, 237, 0.5);
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.stats-board {
    background-color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.stats-board h2 {
    background-color: #444;
    color: #526b84;
    margin: 0;
    padding: 15px;
    text-align: center;
    font-size: 1.4em;
    border-radius: 0;
    font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'Consolas', monospace;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th {
    background-color: #222;
    color: #ccc;
    text-align: left;
    padding: 12px 15px;
    font-size: 0.9em;
    font-weight: 600;
}

.stats-table td {
    padding: 10px 15px;
    border-top: 1px solid #444;
    vertical-align: middle;
}

.stats-table tr:hover td {
    background-color: #3a3a3a;
}

.rank-number {
    font-weight: bold;
    color: #6495ed;
    text-align: center;
    width: 40px;
}

.count-badge {
    background-color: #6495ed;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    min-width: 30px;
    display: inline-block;
}

.operator-logo {
    height: 24px;
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
}

.airport-code {
    display: inline-block;
    background-color: #444;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-left: 8px;
    font-family: 'JetBrains Mono', monospace;
}

.aircraft-details {
    font-size: 0.85em;
    color: #aaa;
    margin-top: 2px;
}

.registration-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    color: #87ceeb;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.update-status {
    text-align: center;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.update-success {
    background-color: #28a745;
    color: white;
}

.update-error {
    background-color: #dc3545;
    color: white;
}

.export-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #28a745 80%, #20c997 100%);
    border: 2px solid #28a745;
    border-radius: 8px;
    color: white;
    padding: 12px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Mobile responsiveness */
@media screen and (max-width: 900px) {
    .header-container {
        padding: 16px 20px;
    }
    .logo-center {
        margin: 0 20px;
    }
    .logo-container img.logo,
    .logo {
        height: 80px;
        max-height: 80px;
    }
    .header h1 {
        font-size: 1.6em;
    }
    .widget-box,
    .weather-widget,
    .digital-clock {
        width: 160px;
        height: 70px;
    }
    .header-container > .weather-widget {
        margin-left: 20px;
    }
    .header-container > .clock-wrapper {
        margin-right: 20px;
    }
}

@media screen and (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 20px;
    }
    
    .period-selector {
        padding: 0 10px;
        gap: 5px;
    }
    
    .period-btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
    
    .export-btn {
        bottom: 10px;
        right: 10px;
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .footer-bar {
        flex-direction: column;
        padding: 0 15px 15px 15px;
        gap: 10px;
    }
    
    .footer-left, 
    .footer-right {
        text-align: center;
        font-size: 0.85em;
        min-width: unset;
    }
}

@media screen and (max-width: 600px) {
    .header-container {
        padding: 10px 10px;
    }
    .logo-center {
        margin: 0 10px;
    }
    .logo-container img.logo,
    .logo {
        height: 60px;
        max-height: 60px;
    }
    .header h1 {
        font-size: 1.2em;
    }
    .widget-box,
    .weather-widget,
    .digital-clock {
        width: 120px;
        height: 60px;
        font-size: 0.9em;
        padding: 5px 8px;
    }
    .header-container > .weather-widget {
        margin-left: 10px;
    }
    .header-container > .clock-wrapper {
        margin-right: 10px;
    }
}

@media screen and (max-width: 500px) {
    .stats-container {
        padding: 5px;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 6px 8px;
        font-size: 0.85em;
    }
    
    .operator-logo {
        height: 20px;
    }
    
    .airport-code {
        font-size: 0.7em;
        padding: 1px 4px;
    }
}

@media screen and (max-width: 380px) {
    .widget-box,
    .weather-widget,
    .digital-clock {
        width: 100px;
        height: 50px;
        font-size: 0.8em;
        padding: 4px 6px;
    }
    .header-container > .weather-widget {
        margin-left: 5px;
    }
    .header-container > .clock-wrapper {
        margin-right: 5px;
    }
    .weather-icon {
        width: 18px;
        height: 18px;
        margin-right: 4px;
    }
    .weather-temp {
        font-size: 0.9em;
    }
    .weather-desc {
        font-size: 0.7em;
    }
}

@media screen and (max-width: 360px) {
    .widget-box {
        width: 160px;
        font-size: 0.75em;
    }
    
    .logo {
        max-height: 60px;
        height: 60px;
    }
    
    .header h1 {
        font-size: 1.1em;
    }
}
