/* platform_style.css - Car Events Dashboard */

:root {
    /* Color Palette */
    --color-bg: #030712;
    --color-card-bg: rgba(17, 24, 39, 0.7);
    --color-card-border: rgba(255, 255, 255, 0.08);
    --color-primary: #3b82f6;
    /* Modern Blue */
    --color-accent: #f59e0b;
    /* Racing Orange/Amber */
    --color-text-main: #f3f4f6;
    --color-text-muted: #9ca3af;
    --glass-blur: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Effects */
body::before {
    content: "";
    position: fixed;
    top: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    z-index: -1;
}

body::after {
    content: "";
    position: fixed;
    bottom: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.05) 0%, transparent 70%);
    z-index: -1;
}

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

/* Header */
header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-group h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.title-group p {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

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

.stat-card {
    background: var(--color-card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--color-card-border);
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
}

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

.stat-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Event List */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.event-card {
    background: var(--color-card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--color-card-border);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.event-card:hover {
    transform: translateY(-8px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5);
}

.event-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.event-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.event-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: #fff;
}

.event-desc {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--color-card-border);
}

.source-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.source-link:hover {
    color: #60a5fa;
}

.event-date {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Scraper Control */
.admin-bar {
    background: rgba(17, 24, 39, 0.9);
    border-top: 1px solid var(--color-card-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(12px);
    z-index: 100;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Animation */
.loading-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

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

/* Responsive Mobile-First Enhancements */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .title-group {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    
    .title-group img {
        height: 40px !important;
    }

    .title-group h1 {
        font-size: 1.8rem;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 2rem;
    }

    /* Make last stat span entirely if odd */
    .stat-card:last-child {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
    }
    .stat-card:last-child .stat-value {
        font-size: 1.2rem !important;
    }

    .stat-card {
        padding: 1rem;
        border-radius: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .events-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .admin-bar {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-bar .actions {
        display: flex;
        width: 100%;
        gap: 0.5rem;
    }
    
    .admin-bar .btn {
        flex: 1;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    #btn-download-json span, #btn-clear-db span {
        display: none; /* Hide text on small screens, keep icons */
    }
}