/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* Access Screen */
#access-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.access-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.logo {
    margin-bottom: 1rem;
}

.logo svg {
    filter: drop-shadow(0 4px 12px rgba(251, 191, 36, 0.4));
}

.access-container h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.access-container .subtitle {
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.access-container .tagline {
    color: var(--gray-500);
    font-size: 0.75rem;
    margin-bottom: 2rem;
    opacity: 0.7;
}

.access-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.access-form label {
    text-align: left;
    font-weight: 500;
    color: var(--gray-700);
}

.access-form input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
}

.access-form button {
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.access-form button:hover {
    background: var(--primary-dark);
}

.error {
    color: var(--error);
    font-size: 0.875rem;
}

/* Main Screen */
#main-screen {
    min-height: 100vh;
}

header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand svg {
    filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.5));
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

header .version {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.header-tagline {
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 400;
    margin-top: -2px;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

/* Input Section */
.address-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.address-input-wrapper input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.address-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
}

.address-input-wrapper button {
    padding: 0.75rem 1.5rem;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.address-input-wrapper button:hover {
    background: var(--gray-900);
}

.address-input-wrapper button:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.location-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.location-status.validated {
    color: var(--success);
}

.location-status.error {
    color: var(--error);
}

.status-icon {
    font-size: 1.25rem;
}

.location-status.validated .status-icon {
    color: var(--success);
}

.coords-display {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    padding: 0.5rem 0;
    border-top: 1px solid var(--gray-200);
    margin-top: 0.5rem;
}

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

.config-item label {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.config-item input,
.config-item select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
}

/* Slider styling */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slider-wrapper input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-200);
    cursor: pointer;
    padding: 0;
    border: none;
}

.slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.slider-wrapper span {
    font-weight: 600;
    min-width: 2.5rem;
    text-align: right;
    color: var(--primary-dark);
}

.primary-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.primary-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* Loading */
#loading-section {
    text-align: center;
    padding: 3rem;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

#loading-status {
    color: var(--gray-500);
}

/* Results */
.result-card {
    background: var(--gray-50);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Site Classification Card */
.site-classification {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid var(--primary);
}

.site-type-badge {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(37, 99, 235, 0.2);
}

.site-type-badge .badge-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.site-type-badge .badge-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.01em;
}

.classification-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.detail-item .detail-label {
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-item .detail-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-700);
}

.detail-notes {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(37, 99, 235, 0.2);
}

.detail-notes .detail-value {
    font-weight: 400;
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.4;
}

.result-card:last-child {
    margin-bottom: 0;
}

.result-card h3 {
    font-size: 0.9375rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.result-table th,
.result-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.result-table th {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.result-table tbody tr:last-child td {
    border-bottom: none;
}

.highlight-table .row-p50 {
    background: #dbeafe;
    font-weight: 600;
}

.highlight-table .row-p50 td {
    color: var(--primary-dark);
}

.row-p10 td:first-child::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
    margin-right: 0.5rem;
}

.row-p50 td:first-child::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin-right: 0.5rem;
}

.row-p90 td:first-child::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 0.5rem;
}

#data-sources-list {
    list-style: none;
    font-size: 0.875rem;
}

#data-sources-list li {
    padding: 0.25rem 0;
    color: var(--gray-500);
}

#data-sources-list li::before {
    content: '✓';
    color: var(--success);
    margin-right: 0.5rem;
}

.cagr-note {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.75rem;
    font-style: italic;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
    header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }

    header h1 {
        font-size: 1.125rem;
    }

    main {
        padding: 0.75rem;
    }

    section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    section h2 {
        font-size: 1rem;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group button {
        width: 100%;
    }

    .coords-display {
        flex-direction: column;
        gap: 0.25rem;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .result-table {
        font-size: 0.8125rem;
    }

    .result-table th,
    .result-table td {
        padding: 0.375rem 0.5rem;
    }

    .result-card {
        padding: 0.75rem;
    }

    .result-card h3 {
        font-size: 0.875rem;
    }

    .site-type-badge .badge-value {
        font-size: 1.25rem;
    }

    .classification-details {
        grid-template-columns: 1fr;
    }

    .address-input-wrapper {
        flex-direction: column;
    }

    .address-input-wrapper button {
        width: 100%;
    }

    .access-container {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .access-container h1 {
        font-size: 1.5rem;
    }

    .logo svg {
        width: 48px;
        height: 48px;
    }
}
