/* ======================================
   Variables y Reset
   ====================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta Azul Institucional */
    --primary-dark: #1e3a5f;
    --primary-medium: #3498db;
    --secondary: #5b7c99;
    --bg-light: #f5f7fa;
    --bg-card: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --sidebar-bg: #e8ecef;
    --border-color: #d1d8dd;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ======================================
   Header
   ====================================== */
header {
    background-color: var(--primary-dark);
    color: var(--text-light);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light);
    margin: 0;
}

nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ======================================
   Layout Principal
   ====================================== */
.layout {
    max-width: 1400px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    flex: 1;
}

/* ======================================
   Contenido Principal
   ====================================== */
.main-content {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.search-section {
    margin-bottom: 2rem;
}

.search-section h2 {
    color: var(--primary-dark);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* ======================================
   Formulario de Búsqueda
   ====================================== */
.search-form {
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 700px;
}

.search-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--text-dark);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-medium);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-search {
    padding: 0.875rem 2rem;
    background-color: var(--primary-medium);
    color: var(--text-light);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    white-space: nowrap;
}

.btn-search:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-search:active:not(:disabled) {
    transform: translateY(0);
}

.btn-search:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ======================================
   Alertas
   ====================================== */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    border-left: 4px solid;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border-color: #c33;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

/* ======================================
   Loader / Spinner
   ====================================== */
.loader {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner {
    border: 4px solid var(--bg-light);
    border-top: 4px solid var(--primary-medium);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader p {
    color: var(--secondary);
    font-size: 1rem;
}

/* ======================================
   Sección de Resultados
   ====================================== */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.result-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.result-card:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

.result-title {
    color: var(--primary-dark);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-details p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.result-details strong {
    color: var(--primary-dark);
    font-weight: 600;
}

.result-cuit {
    color: var(--text-dark);
}

.tipo-persona {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.result-impuestos {
    color: var(--text-dark);
}

.result-provincia {
    color: var(--text-dark);
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary);
    font-size: 1.1rem;
}

/* ======================================
   Sidebar
   ====================================== */
.sidebar {
    background-color: var(--sidebar-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.ad-placeholder {
    background-color: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--secondary);
    font-size: 0.95rem;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ======================================
   Footer
   ====================================== */
footer {
    background-color: var(--primary-dark);
    color: var(--text-light);
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: auto;
    box-shadow: 0 -2px 8px var(--shadow);
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* ======================================
   Responsive Design
   ====================================== */
@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo {
        font-size: 1.5rem;
    }

    .layout {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .search-section h2 {
        font-size: 1.25rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-search {
        width: 100%;
    }

    .result-title {
        font-size: 1.1rem;
    }

    .result-details p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.3rem;
    }

    .main-content {
        padding: 1rem;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
    }

    .btn-search {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* ======================================
   Página de Contacto
   ====================================== */
.contact-page h2 {
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.contact-page > p {
    color: var(--secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.contact-card h3 {
    color: var(--primary-dark);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.contact-card p {
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.contact-card p:last-child {
    margin-bottom: 0;
}

/* ======================================
   Formulario de Contacto
   ====================================== */
.contact-form {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-label .required {
    color: #e74c3c;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--text-dark);
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--bg-card);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-medium);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    cursor: pointer;
}

.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 0.25rem;
}

.btn-submit {
    width: 100%;
    margin-top: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #28a745;
}

/* ======================================
   Páginas Legales
   ====================================== */
.legal-page h2 {
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.legal-page .last-updated {
    color: var(--secondary);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 2rem;
}

.legal-page section {
    margin-bottom: 2.5rem;
}

.legal-page h3 {
    color: var(--primary-dark);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.legal-page p {
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.legal-page ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.legal-page li {
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.legal-page a {
    color: var(--primary-medium);
    text-decoration: underline;
}

.legal-page a:hover {
    color: #2980b9;
}

.legal-page strong {
    color: var(--primary-dark);
    font-weight: 600;
}

/* ======================================
   Animaciones
   ====================================== */
.result-card {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ======================================
   Panel de Administración
   ====================================== */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.message-card:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.message-card.estado-pendiente {
    border-left: 4px solid #ffc107;
}

.message-card.estado-leido {
    border-left: 4px solid #3498db;
}

.message-card.estado-respondido {
    border-left: 4px solid #28a745;
}

.message-card.estado-desestimado {
    border-left: 4px solid #6c757d;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.message-header h3 {
    color: var(--primary-dark);
    font-size: 1.2rem;
    margin: 0;
    font-weight: 600;
}

.message-header .email {
    color: var(--secondary);
    font-size: 0.9rem;
    font-weight: normal;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-pendiente {
    background-color: #fff3cd;
    color: #856404;
}

.badge-leido {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-respondido {
    background-color: #d4edda;
    color: #155724;
}

.badge-desestimado {
    background-color: #e2e3e5;
    color: #383d41;
}

.message-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--secondary);
}

.message-body {
    background-color: var(--bg-light);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.message-body p {
    margin: 0;
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-annotation {
    background-color: #fff3cd;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    margin-bottom: 1rem;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-action {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background-color: var(--primary-medium);
    color: white;
}

.btn-edit:hover {
    background-color: #2980b9;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}
