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

:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --bg-color: #f8fafc;
    --card-bg: #fff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    max-width: 420px;
    margin: 120px auto;
    padding: 48px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-container h1 {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-container h2 {
    color: var(--text-muted);
    font-size: 1.1em;
    font-weight: 400;
    margin-bottom: 32px;
}

#login-form input {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#login-form button {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#login-form button:hover {
    background: var(--primary-hover);
}

/* Navbar */
.navbar {
    background: #0f172a;
    color: white;
    padding: 0 40px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar h1 {
    font-size: 1.25em;
    font-weight: 700;
}

.nav-links {
    display: flex;
    height: 100%;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 0.9em;
    font-weight: 500;
    transition: color 0.2s, border-bottom 0.2s;
}

.nav-links a:hover {
    color: white;
}

.nav-links a.active {
    color: white;
    border-bottom: 2px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Content */
.content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab {
    display: none;
}

.tab.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Section */
.section {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-success {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary { background: #f1f5f9; color: #475569; }
.btn-secondary:hover { background: #e2e8f0; color: #1e293b; }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-success { background: #dcfce7; color: #16a34a; }
.btn-success:hover { background: #bbf7d0; }

/* Config-specific classes */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Maps and Configs List */
.configs-list, .maps-list, .updates-history {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.config-card, .map-card, .update-card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.config-card h3, .map-card h3 {
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 700;
}

.config-card p, .map-card p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Variant List Styling */
.variant-list {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.variant-item {
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    gap: 24px;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.variant-item:hover {
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    border-color: #cbd5e1;
}

.variant-info {
    flex: 0 0 300px;
}

/* The "arrow" / colored bar title */
.variant-name {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 16px;
    border-radius: 6px;
    color: white;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.variant-description {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 4px;
    font-weight: 500;
}

.variant-size {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.6); /* Modern dark backdrop */
    backdrop-filter: blur(4px);
}

.modal.active {
    display: block;
}

.modal-content.wide-modal {
    max-width: 1000px;
}

.modal-content.large-modal {
    max-width: 800px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 40px;
    margin: 5vh auto;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.close {
    color: #94a3b8;
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover,
.close:focus {
    color: var(--text-main);
    text-decoration: none;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Spinner */
.spinner {
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--primary-color);
}

/* Toastr Styling Overrides (Subtle) */
#toast-container > div {
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .variant-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .variant-info {
        flex: none;
        width: 100%;
    }
}
