/* Reset e variáveis */
:root {
    --brand-yellow: #ffd500;
    --brand-yellow-dark: #e6b800;
    --brand-black: #0b0b0b;
    --surface: #121212;
    --surface-soft: #1f1f1f;
    --surface-strong: #252525;
    --text-light: #f7f7f7;
    --text-muted: #c4c4c4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --border-radius: 18px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.18);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: radial-gradient(circle at top right, rgba(255, 213, 0, 0.16), transparent 20%),
        radial-gradient(circle at bottom left, rgba(255, 213, 0, 0.08), transparent 18%),
        linear-gradient(180deg, #090909 0%, #111111 100%);
    color: var(--text-light);
    line-height: 1.65;
    min-height: 100vh;
}

button,
input,
select {
    font: inherit;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.125rem 0.625rem;
}

header {
    text-align: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.hero {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 1rem;
    box-shadow: var(--shadow);
    position: relative;
}

.hero-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.hero-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.icon-btn,
.close-btn {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    border-radius: 999px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover,
.close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.gear-btn {
    border-radius: 0;
    padding: 0.55rem 0.75rem;
    background: transparent;
    border: none;
    min-width: auto;
    color: #ffffff;
}

.gear-btn:hover {
    background: rgba(255, 255, 255, 0.10);
    transform: none;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 0;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-weight: 600;
}

.logout-btn {
    border: none;
    background: transparent;
    color: var(--text-light);
    padding: 0;
    border-radius: 0;
    font-weight: 600;
}

.logo-mark {
    width: 96px;
    height: 96px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand-yellow), #f0c500);
    color: var(--brand-black);
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.hero-copy {
    max-width: 620px;
}

.eyebrow {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-yellow);
    margin-bottom: 0.75rem;
}

.hero h1 {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    margin-bottom: 0.375rem;
    color: var(--text-light);
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 780px;
    margin: 0 auto;
}

.step-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-soft);
}

.step-section h2 {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-light);
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 1rem;
    justify-items: center;
    align-items: center;
    max-width: 620px;
    margin: 0 auto;
}

.country-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
    background: rgba(255, 255, 255, 0.03);
    width: 132px;
    min-height: 132px;
    max-width: 132px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    text-align: center;
}

.hero-logo {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: #ffffff;
}

.brand-logo {
    width: 72px;
    height: auto;
    object-fit: contain;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

input,
select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

input:focus,
select:focus {
    border-color: var(--brand-yellow);
    background: rgba(255, 255, 255, 0.08);
}

.btn-primary,
.btn-secondary,
.copy-btn {
    border: none;
    border-radius: 16px;
    padding: 0.95rem 1.3rem;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-yellow), var(--brand-yellow-dark));
    color: var(--brand-black);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.12);
    color: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.32);
    padding: 0.75rem 1rem;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.btn-primary:hover,
.btn-secondary:hover,
.copy-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.details-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin-top: 1rem;
}

.details-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.details-toggle .arrow {
    transition: transform 0.2s ease;
}

.details-toggle.expanded .arrow {
    transform: rotate(180deg);
}

.details-panel {
    display: none;
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
}

.details-panel.visible {
    display: block;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
}

.auth-card {
    width: min(480px, 100%);
    background: rgba(15, 15, 15, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.85rem;
    color: var(--text-light);
}

.auth-message {
    margin-top: 0.9rem;
    color: var(--warning-color);
    min-height: 1.2rem;
}

.admin-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-soft);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-header h2 {
    margin-bottom: 0.25rem;
}

.admin-header p {
    color: var(--text-muted);
}

.user-list-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    padding: 1rem;
}

.user-list-card h3 {
    margin-bottom: 1rem;
}

.user-list {
    display: grid;
    gap: 0.85rem;
}

.user-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-row strong {
    color: var(--text-light);
}

.user-row .user-info {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.user-role {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

.btn-edit {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    border-radius: 14px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-edit:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.edit-user-form {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    padding: 1rem;
}

.edit-user-form h3 {
    margin-bottom: 1rem;
}

.edit-user-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.75rem;
}

.cancel-edit-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-light);
}

.status-message {
    border-radius: 20px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #a7f3d0;
}

.status-error {
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.status-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #bfdbfe;
}

@media (max-width: 768px) {
    .hero-actions {
        position: static;
        justify-content: center;
        margin-top: 0.85rem;
    }

    .hero {
        padding: 1.2rem;
    }

    .countries-grid {
        grid-template-columns: repeat(2, minmax(90px, 1fr));
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .countries-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 1.5rem 1rem;
    }

    .step-section {
        padding: 1.5rem 1rem;
    }
}

.country-card:hover {
    border-color: var(--brand-yellow);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.22);
    transform: translateY(-4px);
}

.country-card.selected {
    border-color: var(--brand-yellow);
    background-color: rgba(255, 213, 0, 0.12);
}

.country-card .flag {
    font-size: 2.25rem;
    margin: 0;
    line-height: 1;
}

.country-card span {
    display: block;
    margin-top: 0.4rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.2;
}

/* Formulário */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--brand-yellow);
    box-shadow: 0 0 0 4px rgba(255, 213, 0, 0.16);
}

/* Botões */
.btn-primary {
    background-color: var(--brand-yellow);
    color: var(--brand-black);
    border: none;
    padding: 0.95rem 1.6rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    width: 100%;
    box-shadow: 0 10px 24px rgba(255, 213, 0, 0.25);
}

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

.btn-primary:disabled {
    background-color: rgba(255, 213, 0, 0.6);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Resultado */
.result-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 1.75rem;
    margin-bottom: 1rem;
}

.result-card h3 {
    margin-bottom: 0.75rem;
    color: var(--text-light);
    font-size: 1rem;
}

.result-url {
    word-break: break-all;
    font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
    color: var(--text-light);
}

.copy-btn {
    background-color: var(--brand-yellow);
    color: var(--brand-black);
    border: none;
    padding: 0.65rem 1.15rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.copy-btn:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.copy-btn.copied {
    background-color: var(--warning-color);
    color: var(--brand-black);
}

/* Status messages */
.status-message {
    padding: 1rem 1.1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-light);
}

.status-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.status-info {
    background-color: rgba(255, 213, 0, 0.14);
    color: var(--brand-yellow);
    border: 1px solid rgba(255, 213, 0, 0.35);
}

/* Loading */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--brand-yellow);
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsividade */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .countries-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .country-card {
        padding: 1rem;
    }

    .step-section {
        padding: 1.5rem;
    }
}