/* METTLE - Web UI Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #475569;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.motto {
    color: var(--primary);
    font-style: italic;
    margin-top: 0.25rem;
}

/* Main */
main {
    flex: 1;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Info Cards */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.info-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* API Banner */
.api-banner {
    margin-top: 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.api-banner-content {
    text-align: center;
}

.api-banner h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.api-banner p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.api-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

.api-example {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.875rem;
    color: var(--success);
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

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

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

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.timer {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-weight: 600;
}

.timer.warning {
    color: var(--warning);
}

.timer.danger {
    color: var(--error);
}

/* Challenge */
.challenge-card {
    text-align: center;
}

.challenge-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

.challenge-prompt {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    text-align: left;
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.time-limit {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Feedback */
.feedback {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    margin-bottom: 1rem;
}

.feedback.hidden {
    display: none;
}

.feedback.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.feedback.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Result */
.result-card {
    text-align: center;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.result-message {
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Badge */
.badge-container {
    margin-bottom: 2rem;
}

.badge-container.hidden {
    display: none;
}

.badge {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e293b;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* Results Detail */
.results-detail {
    text-align: left;
    margin-bottom: 2rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.result-item .type {
    font-weight: 500;
}

.result-item .status {
    font-weight: 600;
}

.result-item .status.pass {
    color: var(--success);
}

.result-item .status.fail {
    color: var(--error);
}

.result-item .time {
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
}

/* Error */
.error-card {
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .challenge-prompt {
        font-size: 1.25rem;
    }

    .stats {
        gap: 1.5rem;
    }

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen.active {
    animation: fadeIn 0.3s ease;
}

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
