:root {
    --preto-principal: #000000;
    --preto-secundario: #151515;
    --amarelo-principal: #FACC15;
    --branco: #FFFFFF;
    --cinza-auxiliar: #A3A3A3;
    --borda-cor: #2A2A2A;
    --erro-cor: #EF4444;
    --sucesso-cor: #22C55E;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;cpse
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--preto-principal);
    color: var(--branco);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 3rem 1.5rem;
    text-align: center;
}

a {
    color: var(--amarelo-principal);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1rem;
}

input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--preto-secundario);
    border: 1px solid var(--borda-cor);
    color: var(--branco);
    padding: 0.875rem 1rem;
    border-radius: 8px;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--amarelo-principal);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.15);
}

input::placeholder {
    color: var(--cinza-auxiliar);
}

input.error, select.error {
    border-color: var(--erro-cor);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
}

.error-message {
    color: var(--erro-cor);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    display: none;
}

.error-message.visible {
    display: block;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--amarelo-principal);
    color: var(--preto-principal);
}

.btn-primary:hover:not(:disabled) {
    background-color: #E8B80E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-secondary {
    background-color: transparent;
    color: var(--branco);
    border: 1px solid var(--borda-cor);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--preto-secundario);
    border-color: var(--cinza-auxiliar);
}

.btn-logout {
    background-color: transparent;
    color: var(--cinza-auxiliar);
    border: 1px solid var(--borda-cor);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-logout:hover {
    color: var(--branco);
    border-color: var(--cinza-auxiliar);
}

.btn-export {
    background-color: var(--amarelo-principal);
    color: var(--preto-principal);
}

.btn-export:hover:not(:disabled) {
    background-color: #E8B80E;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 600px;
}

.logo-placeholder {
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, var(--preto-secundario) 0%, var(--preto-principal) 100%);
    border: 2px dashed var(--borda-cor);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cinza-auxiliar);
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.logo-placeholder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: 100%;
    height: 100%;
}

.logo-placeholder.has-logo {
    background: transparent;
    border: none;
    padding: 0;
}

.logo-placeholder.has-logo::before {
    display: none;
}

.page-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--branco);
}

.page-subtitle {
    font-size: clamp(1.125rem, 2.5vw, 1.375rem);
    color: var(--cinza-auxiliar);
    font-weight: 400;
    line-height: 1.5;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

/* Keep the home page content centered and give each action room for its label. */
.page > .container:has(> .page-header) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page > .container > .page-header {
    width: 100%;
    margin-inline: auto;
}

.button-group .btn {
    width: 100%;
    min-width: 0;
    min-height: 64px;
    padding: 1rem 1.25rem;
    white-space: normal;
    text-align: center;
}

@media (min-width: 480px) {
    .button-group {
        flex-direction: row;
        justify-content: center;
    }
    
    .button-group .btn {
        flex: 1 1 0;
    }
}

.form-container {
    width: 100%;
    max-width: 480px;
    background-color: var(--preto-secundario);
    border: 1px solid var(--borda-cor);
    border-radius: 16px;
    padding: 2.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 560px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.success-container {
    text-align: center;
    max-width: 400px;
}

.success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
    background-color: rgba(34, 197, 94, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sucesso-cor);
}

.success-icon svg {
    width: 48px;
    height: 48px;
}

.success-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--branco);
}

.success-message {
    font-size: 1.125rem;
    color: var(--cinza-auxiliar);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.admin-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background-color: var(--preto-secundario);
    border-bottom: 1px solid var(--borda-cor);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.admin-header .logo-placeholder {
    width: 40px;
    height: 40px;
    margin: 0;
    flex-shrink: 0;
}

.admin-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--branco);
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-main {
    flex: 1;
    padding: 2rem 1.5rem;
}

/* The login layout has a header; use the remaining viewport height to center
   the form within the content area instead of centering it inside its container. */
.admin-layout:has(.login-container) .admin-main {
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-layout:has(.login-container) .admin-main > .container {
    width: 100%;
}

.login-container {
    margin: 0 auto;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--preto-secundario);
    border: 1px solid var(--borda-cor);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--amarelo-principal);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9375rem;
    color: var(--cinza-auxiliar);
}

.table-container {
    overflow-x: auto;
    background-color: var(--preto-secundario);
    border: 1px solid var(--borda-cor);
    border-radius: 12px;
}

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

thead {
    background-color: var(--preto-principal);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--cinza-auxiliar);
    border-bottom: 1px solid var(--borda-cor);
    white-space: nowrap;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--borda-cor);
    color: var(--branco);
}

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

tbody tr:hover td {
    background-color: rgba(250, 204, 21, 0.03);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 180px;
    flex: 1;
}

.filter-group label {
    font-size: 0.8125rem;
    color: var(--cinza-auxiliar);
    font-weight: 500;
}

.filter-group input, .filter-group select {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.export-btn-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
    background-color: var(--preto-secundario);
    border: 1px solid var(--borda-cor);
    border-radius: 16px;
    padding: 2.5rem;
    margin: auto;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--cinza-auxiliar);
    margin-bottom: 2rem;
}

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--preto-secundario);
    border: 1px solid var(--borda-cor);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--sucesso-cor);
}

.toast.error {
    border-left: 4px solid var(--erro-cor);
}

.toast.info {
    border-left: 4px solid var(--amarelo-principal);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(10, 10, 10, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--borda-cor);
    border-top-color: var(--amarelo-principal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.privacy-notice {
    font-size: 0.75rem;
    color: var(--cinza-auxiliar);
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--borda-cor);
    line-height: 1.5;
}

.privacy-notice a {
    color: var(--amarelo-principal);
    text-decoration: underline;
}

@media (max-width: 640px) {
    .form-container, .login-container {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .page {
        padding: 2rem 1rem;
    }
    
    .toast {
        left: 1rem;
        right: 1rem;
        min-width: auto;
    }
    
    .admin-header .container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-nav {
        width: 100%;
        justify-content: center;
    }
    
    .admin-nav .btn {
        flex: 1;
        min-width: 0;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: 0;
        width: 100%;
    }
    
    .table-container {
        border-radius: 8px;
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 14px;
    }
    
    .logo-placeholder {
        width: 140px;
        height: 140px;
    }
    
    .form-container, .login-container {
        padding: 1.25rem;
        border-radius: 10px;
        margin: 0 0.5rem;
    }
    
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .btn-primary, .btn-secondary, .btn-export {
        min-height: 48px;
    }
    
    input, select, textarea {
        padding: 1rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .page-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }
    
    .page-subtitle {
        font-size: clamp(1rem, 3vw, 1.25rem);
    }
    
    .success-title {
        font-size: 1.75rem;
    }
    
    .success-message {
        font-size: 1rem;
    }
    
    .success-icon {
        width: 80px;
        height: 80px;
    }
    
    .success-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .admin-title {
        font-size: 1.125rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .btn-logout, .btn-export {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

@media (min-width: 1024px) {
    .form-container, .login-container {
        padding: 3rem;
    }
    
    .page {
        padding: 4rem 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .page {
        padding: 1.5rem 1rem;
        min-height: 100vh;
    }
    
    .form-container, .login-container {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .success-container {
        padding: 1rem;
    }
}

:focus-visible {
    outline: 2px solid var(--amarelo-principal);
    outline-offset: 2px;
}

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--amarelo-principal);
    outline-offset: 2px;
}
