/* Pokedex Theme Styles */
:root {
    --dex-red: #dc0a2d;
    --dex-dark-red: #8B0000;
    --dex-blue: #28AAFD;
    --dex-yellow: #FFCB05;
    --dex-green: #4CAF50;
    --dex-bg: #f4f4f4;
    --dex-screen: #E0F7FA;
    --dex-border: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dex-red);
    color: var(--dex-border);
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    border-radius: 15px;
    border: 8px solid var(--dex-border);
    box-shadow: inset -5px -5px 15px rgba(0,0,0,0.3), 5px 5px 15px rgba(0,0,0,0.5);
    position: relative;
    overflow-x: hidden;
}

/* Add Pokedex top light decorations */
body::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: var(--dex-blue);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.5), inset -2px -2px 5px rgba(0,0,0,0.3);
}

body::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 80px;
    width: 15px;
    height: 15px;
    background: var(--dex-yellow);
    border-radius: 50%;
    border: 2px solid var(--dex-border);
    box-shadow: 15px 0 0 var(--dex-yellow), 30px 0 0 var(--dex-green);
}

h1, h2, h3 {
    margin-top: 50px;
    color: white;
    text-shadow: 2px 2px 0px var(--dex-border);
    text-align: center;
}

/* Inner Screen Area */
.screen-area {
    background-color: var(--dex-screen);
    border: 5px solid var(--dex-border);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

/* Navigation Links */
.nav-links {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    margin-top: 60px; /* Make space for lights */
    background: var(--dex-dark-red);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--dex-border);
}

.nav-links a {
    text-decoration: none;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    color: var(--dex-border);
    font-weight: bold;
    border: 2px solid var(--dex-border);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s;
}

.nav-links a:hover {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.nav-links a.logout {
    background: #555 !important;
    color: white !important;
}

/* Cards (Bussydex & Details) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 3px solid var(--dex-border);
    opacity: 0.7;
    position: relative;
    text-align: center;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.card.active {
    background: #FFF9C4;
    border-color: var(--dex-blue);
    opacity: 1;
}

.card:hover {
    transform: scale(1.02);
}

.badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--dex-yellow);
    color: var(--dex-border);
    border: 2px solid var(--dex-border);
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.bus-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.bus-details {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.filter-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--dex-border);
}

.filter-btn, select, input, button {
    padding: 8px 16px;
    border: 2px solid var(--dex-border);
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

button:hover, .filter-btn:hover {
    background: #f0f0f0;
}

button:active, .filter-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0;
}

.bus-form {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 3px solid var(--dex-border);
}

.bus-form h3 {
    margin-top: 0;
    color: var(--dex-border);
    text-shadow: none;
}

/* Leaderboard Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border: 3px solid var(--dex-border);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
}

th {
    background-color: var(--dex-blue);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 0 var(--dex-border);
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

a {
    color: var(--dex-blue);
    font-weight: bold;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Result and history boxes */
.result-card, .bus-header, .overview {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 3px solid var(--dex-border);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.history-item {
    padding: 10px;
    border-bottom: 1px dashed #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-table tr td { color: #333; }
.leaderboard-table tr.podium-1 { background-color: #fffac9 !important; }
.leaderboard-table tr.podium-2 { background-color: #e0e0e0 !important; }
.leaderboard-table tr.podium-3 { background-color: #ffe6cc !important; }

/* Timeline profile specific */
.timeline {
    text-align: left;
    margin-top: 20px;
}
.timeline-item {
    background: white;
    border: 2px solid var(--dex-border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.timeline-item span.date { color: #888; font-size: 0.9em; float: right; }
.timeline-item h4 { margin: 0 0 5px 0; color: var(--dex-border); text-shadow: none; font-size: 1.1em; }

/* Mobile Optimization */
@media screen and (max-width: 600px) {
    body {
        margin: 10px;
        padding: 10px;
        border-width: 4px;
        border-radius: 10px;
    }
    
    /* Scale down top Pokedex decorations */
    body::before {
        top: 10px; left: 10px; width: 25px; height: 25px;
    }
    body::after {
        top: 15px; left: 45px; width: 10px; height: 10px;
        box-shadow: 15px 0 0 var(--dex-yellow), 30px 0 0 var(--dex-green);
    }
    
    /* Adjust headings */
    h1 { font-size: 1.6em; margin-top: 40px; }
    h2 { font-size: 1.4em; }
    h3 { font-size: 1.2em; }
    
    /* Make nav links stack for larger touch targets */
    .nav-links {
        flex-direction: column;
        gap: 8px;
        margin-top: 40px;
    }
    .nav-links a {
        text-align: center;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Adjust grids for smaller screens */
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    .bus-name { font-size: 16px; }
    .bus-details { font-size: 12px; }
    
    /* Login & register boxes */
    .login-box {
        width: calc(100% - 20px);
        margin: 40px auto;
        padding: 15px;
    }
    
    /* Forms and inputs */
    input, button, #reg-input {
        width: 100% !important;
        box-sizing: border-box;
        margin: 5px 0;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    /* Handle wide tables so they don't break viewport */
    .screen-area {
        padding: 10px;
        overflow-x: auto;
    }
    
    th, td {
        padding: 8px 4px;
        font-size: 0.85em;
    }
    
    /* Timeline adjustments */
    .timeline-item span.date {
        float: none;
        display: block;
        margin-bottom: 5px;
    }
    
    .overview {
        font-size: 15px;
        padding: 10px;
    }
}
