* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

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

.sidebar {
    width: 250px;
    background: #1f2933;
    color: white;
    padding: 25px 0;
}

.sidebar-logo {
    padding: 0 22px 25px;
    font-size: 18px;
    font-weight: bold;
}

.sidebar-logo span {
    display: block;
    margin-top: 5px;
    color: #1bbc9b;
    font-size: 13px;
    font-weight: normal;
}

.sidebar-nav a {
    display: block;
    padding: 10px 22px;
    color: #d1d5db;
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #16a085;
    color: white;
}

.nav-title {
    margin-top: 22px;
    padding: 0 22px 7px;
    color: #8f9ba8;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.main-content {
    flex: 1;
}

.topbar {
    height: 75px;
    padding: 0 30px;
    background: white;
    border-bottom: 1px solid #e5e7eb;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
}

.content {
    padding: 30px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.card,
.panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 22px;
}

.card span {
    display: block;
    color: #6b7280;
    margin-bottom: 10px;
}

.card strong {
    font-size: 30px;
}

.panel h2 {
    margin-top: 0;
}

/* LOGIN */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6f8;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 35px;
}

.login-logo {
    margin-bottom: 30px;
    font-size: 20px;
    font-weight: bold;
}

.login-logo span {
    display: block;
    margin-top: 4px;
    color: #16a085;
    font-size: 13px;
    font-weight: normal;
}

.login-box h1 {
    margin: 0 0 25px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
}

.form-group input:focus {
    outline: none;
    border-color: #1bbc9b;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 6px;
    background: #16a085;
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

.btn-primary:hover {
    background: #138d75;
}

.login-error {
    margin-bottom: 20px;
    padding: 12px;
    background: #fee2e2;
    border-radius: 6px;
    color: #991b1b;
}

/* FILTROS */

.page-tools {
    margin-bottom: 25px;
}

.filters {
    display: flex;
    align-items: end;
    gap: 15px;
}

.filters label {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
    font-weight: bold;
}

.filters select {
    min-width: 160px;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
}

.btn-filter {
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: #16a085;
    color: white;
    cursor: pointer;
}


/* RESUMEN */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}


/* TABLAS */

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h2 {
    margin: 0;
}

.panel-header span {
    color: #6b7280;
    font-size: 14px;
}

.table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 13px 15px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.admin-table th {
    background: #f8fafb;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
}

.admin-table tbody tr:hover {
    background: #f8fafb;
}


/* ESTADOS */

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.status-oficial {
    background: #d1fae5;
    color: #065f46;
}

.status-estimado {
    background: #fef3c7;
    color: #92400e;
}


/* ACCIONES */

.actions a {
    color: #16a085;
    font-weight: bold;
    text-decoration: none;
}

.actions a:hover {
    text-decoration: underline;
}

/* FICHA CALENDARIO */

.back-link {
    color: #16a085;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

.calendar-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.calendar-info > div {
    padding: 15px;
    background: #f8fafb;
    border-radius: 6px;
}

.calendar-info span {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
}

.calendar-info strong {
    font-size: 16px;
}

.holiday-type {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.holiday-nacional {
    background: #fee2e2;
    color: #991b1b;
}

.holiday-autonomico {
    background: #dbeafe;
    color: #1e40af;
}

.holiday-provincial {
    background: #e0e7ff;
    color: #3730a3;
}

.holiday-local {
    background: #f3e8ff;
    color: #6b21a8;
}

.calendar-edit-form {
    display: flex;
    align-items: end;
    gap: 15px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e5e7eb;
}

.calendar-edit-form label {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
    font-weight: bold;
}

.calendar-edit-form select,
.calendar-edit-form input {
    min-width: 180px;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
}

.btn-save {
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: #16a085;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.btn-save:hover {
    background: #1bbc9b;
}

.alert-success {
    margin-top: 15px;
    padding: 12px 15px;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    background: #ecfdf5;
    color: #065f46;
}

.alert-warning {
    margin-bottom: 25px;
    padding: 15px 18px;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    background: #fffbeb;
    color: #92400e;
}

.alert-warning strong {
    display: block;
    margin-bottom: 5px;
}

.alert-warning p {
    margin: 0;
}

.holiday-edit-form {
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    gap: 20px;
}

.holiday-edit-form label {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
    font-weight: bold;
}

.holiday-edit-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
}

.assignment-list {
    margin: 15px 0 0 20px;
    padding: 0;
}

.assignment-list li {
    margin-bottom: 7px;
}

.assignment-list span {
    color: #6b7280;
}

.holiday-edit-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn-warning {
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: #d97706;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.btn-warning:hover {
    background: #b45309;
}

/* ========================================
   Añadir festivo
======================================== */

.add-holiday-section {
    padding: 20px 25px 25px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafb;
}

.add-holiday-section .section-header {
    margin-bottom: 18px;
}

.add-holiday-section .section-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1f2933;
}

.add-holiday-form {
    display: grid;
    grid-template-columns: 180px 1fr 200px auto;
    gap: 20px;
    align-items: end;
}

.add-holiday-form > div {
    min-width: 0;
}

.add-holiday-form label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.add-holiday-form input,
.add-holiday-form select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2933;
    font: inherit;
}

.add-holiday-form input:focus,
.add-holiday-form select:focus {
    outline: none;
    border-color: #1bbc9b;
}

.add-holiday-actions {
    display: flex;
    align-items: flex-end;
}

.add-holiday-actions .btn-save {
    white-space: nowrap;
    height: 41px;
}

/* Responsive */
@media (max-width: 900px) {

    .add-holiday-form {
        grid-template-columns: 1fr 1fr;
    }

    .add-holiday-actions {
        align-items: stretch;
    }

    .add-holiday-actions .btn-save {
        width: 100%;
    }
}

@media (max-width: 600px) {

    .add-holiday-form {
        grid-template-columns: 1fr;
    }
}

.action-delete {
    margin-left: 12px;
    color: #dc2626;
}

.action-delete:hover {
    color: #991b1b;
}

.btn-danger {
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: #dc2626;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #f3f4f6;
    color: #1f2933;
}

/* ========================================
   CONTACTOS
======================================== */

.contactos-listado,
.contacto-detalle {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 25px;
}

/* Cabecera y contador */

.contactos-listado > p {
    margin: 0 0 20px;
    color: #6b7280;
    font-size: 14px;
}

.contactos-listado > p strong {
    color: #1f2933;
    font-size: 18px;
}

/* Botón de eliminación */

.btn-eliminar-contactos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    margin-bottom: 18px;
    border: 0;
    border-radius: 6px;
    background: #dc2626;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.btn-eliminar-contactos:hover {
    background: #b91c1c;
}

/* Tabla de contactos */

.contactos-listado .admin-table {
    font-size: 14px;
}

.contactos-listado .admin-table th,
.contactos-listado .admin-table td {
    vertical-align: middle;
}

.contactos-listado .admin-table th:first-child,
.contactos-listado .admin-table td:first-child {
    width: 45px;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

.contactos-listado .admin-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #16a085;
}

.contactos-listado .admin-table td:nth-child(2) {
    white-space: nowrap;
    color: #6b7280;
    font-size: 13px;
}

.contactos-listado .admin-table td:nth-child(6) {
    min-width: 220px;
    max-width: 420px;
    overflow-wrap: anywhere;
}

.contactos-listado .admin-table a {
    color: #16a085;
    text-decoration: none;
    font-weight: 600;
}

.contactos-listado .admin-table a:hover {
    text-decoration: underline;
}

/* Paginación */

.contactos-paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 25px;
    font-size: 14px;
}

.contactos-paginacion a {
    padding: 9px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #16a085;
    font-weight: 600;
    text-decoration: none;
}

.contactos-paginacion a:hover {
    background: #ecfdf5;
    border-color: #16a085;
}

.contactos-paginacion span {
    color: #6b7280;
}

/* Ficha individual */

.contacto-detalle > p:first-child {
    margin: 0 0 22px;
}

.contacto-detalle > p:first-child a {
    color: #16a085;
    font-weight: 600;
    text-decoration: none;
}

.contacto-detalle > p:first-child a:hover {
    text-decoration: underline;
}

.contacto-detalle h2 {
    margin: 0 0 20px;
    font-size: 20px;
}

.contacto-detalle .admin-table {
    margin-bottom: 25px;
}

.contacto-detalle .admin-table th {
    width: 150px;
}

.contacto-detalle .admin-table td {
    overflow-wrap: anywhere;
}

.contacto-detalle h3 {
    margin: 25px 0 15px;
    font-size: 17px;
}

/* Adaptación a pantallas pequeñas */

@media (max-width: 768px) {

    .contactos-listado,
    .contacto-detalle {
        padding: 15px;
    }

    .contactos-listado .admin-table {
        min-width: 850px;
    }

    .contacto-detalle .admin-table th {
        width: 105px;
    }

    .contactos-paginacion {
        gap: 10px;
    }
}

/* Filtros del historial de búsquedas */

.filters {
    flex-wrap: wrap;
}

.filters input {
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font: inherit;
}

.filters input:focus {
    outline: none;
    border-color: #1bbc9b;
}
/* ========================================
   GEOGRAFÍA - REGIONES
======================================== */

.region-edit-form {
    max-width: 650px;
    margin-top: 25px;
}

.region-edit-form .form-group input {
    width: 100%;
}

.region-form-help {
    margin: 8px 0 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}

.region-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 25px;
}

.region-edit-form .btn-save {
    width: auto;
}

@media (max-width: 600px) {
    .region-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .region-form-actions .btn-save,
    .region-form-actions .btn-secondary {
        width: 100%;
    }
}

/* GEOGRAFÍA - SELECTORES */

.region-edit-form .geo-select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2933;
    font-size: 15px;
}

.region-edit-form .geo-select:focus {
    outline: none;
    border-color: #1bbc9b;
}

/* ========================================
   GEOGRAFÍA - LOCALIDADES
======================================== */

.geo-checkbox-label {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
}

.region-edit-form .geo-checkbox-label input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: #16a085;
}

.filters input[type="text"] {
    min-width: 200px;
}

.filters select {
    max-width: 250px;
}

/* Herramientas del listado de festivos */

.page-tools {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-tools > .btn-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    text-decoration: none;
    white-space: nowrap;
}

/* Mensajes de confirmación y error */

.alert {
    padding: 14px 18px;
    margin: 18px 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: #e8f7ef;
    color: #17663d;
    border: 1px solid #a8dfbd;
}

.alert-danger {
    background: #fdecec;
    color: #9f2525;
    border: 1px solid #efb1b1;
}

/* Botón secundario para cancelar */

.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #f1f5f9;
}
/* Formularios de gestión territorial */
.territorial-form { display: grid; gap: 18px; max-width: 760px; }
.territorial-form > div:not(.holiday-edit-actions) { display: flex; flex-direction: column; gap: 7px; }
.territorial-form input, .territorial-form select, .territorial-form textarea { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.territorial-form select[multiple] { min-height: 140px; }
.territorial-form .holiday-edit-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
