/* ========================================
   CONTROLE ETP - ESTILOS FRONTEND
   Reestruturação visual e layout responsivo
   ======================================== */

/* Design system - variáveis */
:root {
    --primary-color: #5b21b6;
    --primary-light: #7c3aed;
    --secondary-color: #4f46e5;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --accent-color: #f59e0b;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --dark-text: #1e293b;
    --light-text: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.06);
    --shadow-hover: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.06);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --transition: 0.2s ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset e container responsivo */
.controle-etp-container {
    max-width: 960px;
    margin: 0 auto;
    padding: var(--space-4);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-text);
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .controle-etp-container {
        padding: var(--space-6);
    }
}

.controle-etp-container *,
.controle-etp-container *::before,
.controle-etp-container *::after {
    box-sizing: border-box;
}

/* Cabeçalho - próximo número */
.etp-header {
    margin-bottom: var(--space-6);
}

.proximo-numero-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    animation: slideInDown 0.5s ease;
    position: relative;
    overflow: hidden;
}

.proximo-numero-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.08));
    pointer-events: none;
}

.numero-icon {
    font-size: 2.5rem;
    opacity: 0.95;
    flex-shrink: 0;
}

.numero-content {
    flex: 1;
    min-width: 0;
}

.numero-content h2 {
    margin: 0 0 var(--space-2) 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    opacity: 0.95;
}

.numero-display {
    margin: var(--space-3) 0;
}

.numero {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.numero-ano {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    opacity: 0.95;
    margin-left: 2px;
}

.numero-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.ano-info {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    font-size: 0.8125rem;
    opacity: 0.95;
}

.ano-info .dashicons {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
}

.ano-info small {
    font-size: inherit;
}

/* Badge do ano na lista de ETPs */
.numero-ano-badge {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin-top: 2px;
}

/* Seção de Links */
.etp-links-compacta {
    background: var(--card-bg);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-6);
    animation: slideInUp 0.4s ease 0.1s both;
    border: 1px solid var(--border-color);
}

.links-grid-compacta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
}

.link-item-compacto {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    background: var(--light-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.link-item-compacto::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    transition: var(--transition);
}

.link-item-compacto:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.link-item-compacto:hover::before {
    width: 5px;
}

.link-content-compacto {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-width: 0;
}

.link-content-compacto h4 {
    margin: 0;
    color: var(--dark-text);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
}

.btn-compacto {
    padding: var(--space-2) var(--space-4);
    font-size: 0.8125rem;
    font-weight: 600;
    min-width: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Formulário */
.etp-form-container {
    background: var(--card-bg);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-6);
    animation: slideInUp 0.4s ease 0.1s both;
    border: 1px solid var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.875rem;
}

.form-label .dashicons {
    color: var(--primary-color);
    font-size: 1.125rem;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.form-control {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--card-bg);
    font-family: inherit;
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.12);
}

.form-control::placeholder {
    color: var(--light-text);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Captcha */
.captcha-container {
    margin: var(--space-6) 0;
    padding: var(--space-5);
    background: var(--light-bg);
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
}

.captcha-slider {
    margin-top: var(--space-4);
}

.captcha-track {
    position: relative;
    background: var(--border-color);
    height: 52px;
    border-radius: 999px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.captcha-track:hover {
    background: #cbd5e1;
}

.captcha-thumb {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 46px;
    height: 46px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: grab;
}

.captcha-thumb:active {
    cursor: grabbing;
}

.captcha-thumb.completed {
    background: var(--success-color);
    color: white;
    left: calc(100% - 49px);
}

.captcha-thumb .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    transition: var(--transition);
}

.captcha-thumb.completed .dashicons:before {
    content: "\f147";
}

.captcha-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--light-text);
    font-weight: 500;
    font-size: 0.9375rem;
    pointer-events: none;
    transition: var(--transition);
}

.captcha-track.completed .captcha-text {
    color: var(--success-color);
    font-weight: 600;
}

/* Botões */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-6);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-width: 140px;
    justify-content: center;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

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

.btn-secondary:hover {
    background: var(--light-bg);
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.btn-small {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
    min-width: auto;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
}

.btn-link:hover {
    color: var(--secondary-color);
}

/* Lista de ETPs */
.etp-lista-container {
    background: var(--card-bg);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    animation: slideInUp 0.4s ease 0.1s both;
    border: 1px solid var(--border-color);
}

.etp-lista-container h3 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-5) 0;
    color: var(--dark-text);
    font-size: 1.125rem;
    font-weight: 700;
}

.etp-lista-container h3 .dashicons {
    color: var(--primary-color);
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

.etp-lista-grid {
    display: grid;
    gap: var(--space-4);
}

.etp-item {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--light-bg);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
}

.etp-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

@media (min-width: 640px) {
    .etp-item {
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: var(--space-2) var(--space-4);
    }
    
    .etp-item .etp-numero {
        grid-row: 1 / -1;
        align-self: start;
    }
    
    .etp-item .etp-info {
        grid-column: 2;
        grid-row: 1;
    }
    
    .etp-item .etp-objeto {
        grid-column: 2 / -1;
        grid-row: 2;
    }
}

.etp-numero {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.etp-numero .numero {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.etp-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-1);
    font-size: 0.875rem;
}

@media (min-width: 480px) {
    .etp-info {
        grid-template-columns: 1fr 1fr;
    }
}

.etp-secretaria {
    font-weight: 600;
    color: var(--primary-color);
    grid-column: 1 / -1;
}

.etp-setor, .etp-responsavel, .etp-data {
    color: var(--light-text);
}

.etp-objeto {
    color: var(--dark-text);
    font-size: 0.875rem;
    line-height: 1.5;
}

.no-etps {
    text-align: center;
    padding: var(--space-8);
    color: var(--light-text);
    font-size: 0.9375rem;
}

.no-etps .dashicons {
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   MODAIS - DESIGN MODERNO E RESPONSIVO
   ======================================== */

/* Base do Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 15px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Garantir que o modal fique visível */
html.modal-open,
body.modal-open {
    overflow: hidden;
}

.modal-modern {
    background: transparent;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 420px;
    width: 100%;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header do Modal Moderno */
.modal-header-modern {
    padding: 16px 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.modal-header-modern h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-text);
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--light-bg);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--light-text);
}

.modal-close-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.modal-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-icon-wrapper.warning {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.modal-icon-wrapper.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.modal-icon-wrapper .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Body do Modal Moderno */
.modal-body-modern {
    padding: 0 16px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 280px);
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar personalizado para o modal */
.modal-body-modern::-webkit-scrollbar {
    width: 6px;
}

.modal-body-modern::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 3px;
}

.modal-body-modern::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.modal-body-modern::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.modal-body-modern.centered {
    text-align: center;
}

/* Número em Destaque */
.etp-numero-destaque {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 12px;
}

.etp-numero-destaque .label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.etp-numero-destaque .valor {
    font-size: 24px;
    font-weight: 800;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Dados de Confirmação Modernos */
.confirmacao-dados-modern {
    display: grid;
    gap: 8px;
}

.dado-item-modern {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    transition: var(--transition);
}

.dado-item-modern:hover {
    background: #eef2ff;
}

.dado-item-modern.full-width {
    grid-column: 1 / -1;
    min-height: auto;
}

.dado-item-modern.full-width .dado-content {
    width: 100%;
}

.dado-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dado-icon .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.dado-content {
    flex: 1;
    min-width: 0;
}

.dado-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--light-text);
    margin-bottom: 1px;
}

.dado-valor {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-text);
    word-break: break-word;
}

.dado-valor.objeto {
    font-weight: 400;
    line-height: 1.4;
    font-size: 12px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: none;
}

/* Footer do Modal Moderno */
.modal-footer-modern {
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
}

.modal-footer-modern.centered {
    justify-content: center;
}

/* Botões do Modal */
.btn-cancel-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    color: var(--light-text);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel-modern:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: #fef2f2;
}

.btn-confirm-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-confirm-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-confirm-modern:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-confirm-modern .btn-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: inherit;
}

.btn-confirm-modern .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Modal de Sucesso */
.modal-success .modal-header-modern {
    padding-top: 32px;
    padding-bottom: 8px;
}

.modal-success .modal-header-modern.success {
    background: transparent;
}

.success-ring {
    position: absolute;
    inset: -4px;
    border: 2px solid #10b981;
    border-radius: 50%;
    animation: successRing 0.6s ease-out 0.2s both;
}

@keyframes successRing {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 0.5;
    }
}

.success-title {
    font-size: 22px;
    font-weight: 700;
    color: #059669;
    margin: 16px 0;
}

.etp-numero-sucesso {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 20px 32px;
    border-radius: 12px;
    display: inline-block;
    margin: 8px 0 20px;
}

.etp-numero-sucesso .label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.etp-numero-sucesso .valor {
    font-size: 36px;
    font-weight: 800;
}

.success-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.success-details p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    color: var(--light-text);
    font-size: 14px;
}

.success-details .dashicons {
    color: #10b981;
    font-size: 16px;
}

.btn-success-modern {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-success-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Animação de Check */
.success-animation {
    margin: 0 auto 16px;
}

.checkmark-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: scaleIn 0.3s ease-out;
}

.checkmark {
    width: 30px;
    height: 50px;
    border-right: 4px solid white;
    border-bottom: 4px solid white;
    transform: rotate(45deg) translate(-5px, -5px);
    animation: checkmarkDraw 0.3s ease-out 0.2s both;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes checkmarkDraw {
    from {
        height: 0;
        width: 0;
    }
    to {
        height: 50px;
        width: 30px;
    }
}

/* Animações */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 768px) {
    .controle-etp-container {
        padding: var(--space-4);
    }
    
    .proximo-numero-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-5);
    }
    
    .numero-icon {
        font-size: 2.25rem;
    }
    
    .ano-info {
        margin: var(--space-3) auto 0;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        min-width: 0;
    }
    
    .links-grid-compacta {
        grid-template-columns: 1fr;
    }
    
    .link-item-compacto {
        padding: var(--space-3) var(--space-4);
    }
    
    .link-content-compacto {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .btn-compacto {
        align-self: stretch;
        text-align: center;
    }
    
    /* Modal */
    .modal {
        padding: var(--space-3);
        padding-top: 80px;
        align-items: flex-start;
    }
    
    .modal-content {
        max-height: calc(100vh - 60px);
        border-radius: var(--radius);
        max-width: 100%;
    }
    
    .modal-body-modern {
        max-height: calc(100vh - 260px);
    }
    
    .modal-header-modern {
        padding: 20px 20px 12px;
    }
    
    .modal-header-modern h3 {
        font-size: 18px;
        padding-right: 30px;
    }
    
    .modal-close-btn {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }
    
    .modal-icon-wrapper {
        width: 48px;
        height: 48px;
    }
    
    .modal-icon-wrapper .dashicons {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }
    
    .modal-body-modern {
        padding: 0 16px 16px;
    }
    
    .etp-numero-destaque {
        padding: 14px 20px;
    }
    
    .etp-numero-destaque .valor {
        font-size: 28px;
    }
    
    .dado-item-modern {
        padding: 12px;
    }
    
    .dado-icon {
        width: 32px;
        height: 32px;
    }
    
    .dado-valor {
        font-size: 14px;
    }
    
    .modal-footer-modern {
        padding: 12px 16px 16px;
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .btn-cancel-modern,
    .btn-confirm-modern,
    .btn-success-modern {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    /* Modal de Sucesso Responsivo */
    .success-title {
        font-size: 20px;
    }
    
    .etp-numero-sucesso {
        padding: 16px 24px;
    }
    
    .etp-numero-sucesso .valor {
        font-size: 30px;
    }
    
    .checkmark-circle {
        width: 70px;
        height: 70px;
    }
    
    .checkmark {
        width: 25px;
        height: 42px;
    }
}

@media (max-width: 480px) {
    .controle-etp-container {
        padding: 10px;
    }
    
    .etp-form-container,
    .etp-lista-container {
        padding: 20px;
    }
    
    .proximo-numero-card {
        padding: 15px;
    }
    
    .numero {
        font-size: 28px;
    }
    
    .numero-ano {
        font-size: 20px;
    }
    
    .form-control {
        font-size: 16px; /* Previne zoom no iOS */
    }
    
    .captcha-track {
        height: 45px;
    }
    
    .captcha-thumb {
        width: 41px;
        height: 41px;
    }
    
    /* Modal Extra Pequeno */
    .modal {
        padding: 8px;
        padding-top: 50px;
        align-items: flex-start;
    }
    
    .modal-content {
        max-height: calc(100vh - 30px);
    }
    
    .modal-header-modern {
        padding: 12px 14px 10px;
    }
    
    .modal-body-modern {
        padding: 0 12px 12px;
        max-height: calc(100vh - 220px);
    }
    
    .modal-footer-modern {
        padding: 10px 12px;
    }
    
    .dado-item-modern {
        padding: 8px;
    }
    
    .dado-valor.objeto {
        font-size: 11px;
    }
    
    .modal-header-modern h3 {
        font-size: 16px;
    }
    
    .etp-numero-destaque .valor {
        font-size: 24px;
    }
    
    .dado-item-modern {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .dado-icon {
        margin: 0 auto;
    }
    
    .dado-label,
    .dado-valor {
        text-align: center;
    }
    
    .success-details p {
        font-size: 13px;
    }
}

/* Estados de Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensagens de Feedback */
.etp-foreground-error {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000002;
    width: min(92vw, 640px);
    background: #b91c1c;
    color: #ffffff;
    border: 1px solid #991b1b;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    padding: 12px 44px 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    line-height: 1.35;
}

.etp-foreground-error .dashicons {
    flex: 0 0 auto;
}

.etp-foreground-error-text {
    display: block;
}

.etp-foreground-error-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.etp-foreground-error-close:hover {
    opacity: 0.85;
}

.feedback-message {
    padding: var(--space-4);
    border-radius: var(--radius);
    margin: var(--space-4) 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.9375rem;
}

.feedback-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 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;
}

/* Focus visible para navegação por teclado */
.form-control:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Área de toque mínima em mobile (44px) */
@media (max-width: 768px) {
    .btn,
    .form-control,
    .captcha-thumb,
    .link-item-compacto {
        min-height: 44px;
    }
    
    .form-control {
        padding: var(--space-3) var(--space-4);
    }
}

/* Print styles */
@media print {
    .controle-etp-container {
        box-shadow: none;
        padding: 0;
    }
    
    .etp-form-container,
    .etp-lista-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .btn,
    .modal {
        display: none;
    }
}
