/* ===== Variáveis e reset ===== */
:root {
    --color-primary: #1a365d;
    --color-primary-light: #2c5282;
    --color-accent: #2b6cb0;
    --color-success: #276749;
    --color-error: #c53030;
    --color-text: #2d3748;
    --color-text-muted: #718096;
    --color-bg: #f7fafc;
    --color-bg-card: #ffffff;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 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: 8px;
    --radius-lg: 12px;
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
}

/* ===== Acessibilidade ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Container ===== */
.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.subtitle {
    margin: 0;
    font-size: 1rem;
    color: var(--color-text-muted);
}

/* ===== Main ===== */
.main {
    flex: 1;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--color-border);
}

/* ===== Status de carregamento ===== */
.load-status {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.load-status.hidden {
    display: none;
}

.load-status.error {
    color: var(--color-error);
}

/* ===== Validação ===== */
.validation-section {
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.input-code {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-code:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.2);
}

.input-code::placeholder {
    color: var(--color-text-muted);
}

.hint {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.btn-validate {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.05s;
}

.btn-validate:hover:not(:disabled) {
    background: var(--color-primary-light);
}

.btn-validate:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-validate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Área de resultado ===== */
.result-area {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.result-content {
    font-size: 0.95rem;
}

.result-content dl {
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.result-content dt {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.result-content dd {
    margin: 0 0 0.75rem;
    color: var(--color-text);
}

.result-content dd:last-of-type {
    margin-bottom: 0;
}

.result-content .valid-badge {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.35rem 0.75rem;
    background: #c6f6d5;
    color: var(--color-success);
    font-weight: 600;
    border-radius: var(--radius);
}

.result-content .invalid-badge {
    display: inline-block;
    margin-top: 0;
    padding: 0.5rem 0.75rem;
    background: #fed7d7;
    color: var(--color-error);
    font-weight: 600;
    border-radius: var(--radius);
}

.qrcode-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.qrcode-label {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

#qrcode {
    display: inline-block;
}

#qrcode img {
    display: block;
    margin: 0 auto;
}

/* ===== Mensagens ===== */
.message-area {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.message-area.error {
    background: #fed7d7;
    color: var(--color-error);
    border: 1px solid #feb2b2;
}

.message-area.success {
    background: #c6f6d5;
    color: var(--color-success);
    border: 1px solid #9ae6b4;
}

.message-area.info {
    background: #bee3f8;
    color: var(--color-primary);
    border: 1px solid #90cdf4;
}

/* ===== Footer LGPD ===== */
.footer {
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
}

.lgpd-notice {
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Responsivo ===== */
@media (min-width: 480px) {
    .input-group {
        flex-direction: row;
        align-items: stretch;
    }

    .input-code {
        flex: 1;
        min-width: 0;
    }

    .btn-validate {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media (min-width: 600px) {
    .container {
        padding: 2rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .main {
        padding: 2rem;
    }
}
