/* ========== RESET Y BASE ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* ===== LOGIN PAGE ===== */
body.login-page {
    background: #ff004a;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* ===== APP PAGES (dashboard, recursos, etc.) ===== */
body.app-page {
    background: #f5f5f5;
    color: #333;
}

/* ========== LOGIN BOX ========== */
.login-box {
    background: #fff;
    color: #06040c;
    padding: 30px;
    border-radius: 10px;
    width: 100%;
    max-width: 320px;
    margin: 50px auto;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.login-box h2 {
    margin-bottom: 20px;
    color: #ff004a;
    font-size: 20px;
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.login-box button {
    background: #ff004a;
    color: #fff;
    border: none;
    padding: 10px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.login-box button:hover {
    background: #e00040;
}

.error {
    color: red;
    margin-top: 10px;
}

/* ========== NAVBAR SUPERIOR ========== */
header {
    background: #ff004a;
    color: #fff;
    display: flex;
    justify-content: space-between;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 22px;
    color: #fff;
    cursor: pointer;
}

nav {
    display: flex;              /* siempre flex, nunca none */
    flex-direction: column;
    max-height: 0;              /* colapsado en mobile */
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease;
    font-size: 14px;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 13px;
    margin: 0;
    background: #ff004a;
}

nav a:hover {
    background: #e00040;
}

nav.active {
    max-height: 500px; /* lo suficiente para contener todos los links */
    opacity: 1;
}


.header-top h1 {
    font-size: 20px;
    width: 100%;
    margin-left: 5px;
}

.user-info {
    font-size: 14px;
    margin-top: 0;
    width: 100%;
    text-align: center;
    background: #333;
    padding: 10px;
    color: #DDD;
    margin-top: auto;
}

.user-info a {
    color: #fff;
    text-decoration: underline;
}

.usuario-inactivo {
    opacity: 0.5;
}

.estado {
    font-size: 13px;
    font-weight: bold;
}

.estado.activo {
    color: #28a745;
}

.estado.archivado {
    color: #777;
}

.rol.admin { color: #ff004a; font-weight: bold; }
.rol.editor { color: #ff9800; }
.rol.viewer { color: #555; }

a[title] {
    text-decoration: none;
    color: #333;
    margin-right: 8px;
}

a[title]:hover {
    color: #ff004a;
}


/* En pantallas grandes */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
    nav {
        display: flex !important;
        flex-direction: row;
        margin-top: 0;
    }
    .user-info {
        text-align: right;
        margin-left: auto;
    }
}

/* ========== CONTENEDORES ========== */
.container {
    padding: 15px;
    max-width: 100%;
    margin: auto;
}

.box {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    /*margin: 20px auto;*/
    margin-bottom: 14px;
}

.box-title {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.box-title a.button-link {
    font-size: 14px;
    display: block;
    width: 150px;
    padding: 10px;
    text-decoration: none;
}

.container h2, .container h3 {
    margin-bottom: 10px;
}

/* ========== LOGOUT BUTTON ========== */
.logout {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 15px;
    background: #06040c;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
}

.logout:hover {
    background: #333;
}

/* ========== CARDS DE RECURSOS ========== */
.resource-card {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.resource-card h3 {
    margin: 0;
    font-size: 16px;
    color: #111;
}

.meta {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.tag {
    background: #ff004a;
    color: #fff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
}

#tagsTable {
    margin-top: 0;
}

/* ========== TABLAS (para categorías y listados) ========== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
}

table th, table td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
    font-size: 14px;
}

table th {
    background: #f0f0f0;
}

.actions a, .actions button {
    margin-right: 5px;
    text-decoration: none;
    font-size: 13px;
}

form.inline {
    display: inline;
}

.table-name {
    font-weight: bold;
    font-size: 110%;
}

/* ========== FORMULARIOS (buscar_recurso.php) ========== */
form input, 
form select, 
form button, .input-autocomplete {
    padding: 8px;
    margin: 5px 0;
    width: 100%;
    border-radius: 6px;
    border: 1px solid #ccc;
    color: #888;
}

form button {
    background: #ff004a;
    color: #fff;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

form button:hover {
    background: #e00040;
}

.success {
    color: green;
    margin-top: 10px;
}

form label {
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

form input[type="text"]:focus, form input[type="email"]:focus, form input[type="number"]:focus, form select:focus, .input-autocomplete:focus, .custom-multiselect:focus {
    outline: 2px solid #ff004a; /* color corporativo */
    border-color: #ff004a;      /* cambia el borde */
    box-shadow: 0 0 5px rgba(255, 0, 74, 0.6); /* opcional: efecto glow */
}

#map {
    height: 500px;
    width: 100%;
    margin-top: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.map-select {
    background: #FFF;
    padding: 8px 12px;
    margin-top: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.map-select label {
    font-size: 90%;
    font-weight: bold;
    margin-bottom: 4px;
}

.map-clean {
    border-radius: 0 !important;
    height: 200px !important;
    box-shadow: unset !important;
    margin-bottom: 10px !important;
}

/* Ocultar la X de los InfoWindows */
.gm-ui-hover-effect {
    display: none !important;
}

/* ========== MULTISELECT CUSTOM (tags con checkboxes) ========== */
.custom-multiselect {
    position: relative;
    user-select: none;
    margin-bottom: 10px;
    font-size: 14px;
    margin-top: 5px;
}

.select-box {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkboxes {
    display: none;
    border: 1px solid #ccc;
    border-top: none;
    background: #fff;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    width: 100%;
    z-index: 1000;
}

.checkboxes label {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

.checkboxes input[type="checkbox"] {
    flex: 0 0 20px;
    width: 20px;
    margin-right: 8px;
}

.checkboxes label span {
    flex: 1;
    text-align: left;
}

.checkboxes label:hover {
    background: #f0f0f0;
}

.arrow {
    font-size: 12px;
    margin-left: 10px;
}

/* Botones grandes en el dashboard */
.dashboard-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.big-button {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: #ff004a;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.3s;
}

.big-button:hover {
    background: #e00040;
}

/* Mapa en el dashboard */
#map-dashboard {
    width: 100%;
    height: 300px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}


@media (min-width: 768px) {
    .desktop-only {
        display: inline-block;
    }

    .desktop-only-table {
        display: inline-cell !important;
    }
}

/* ===== Formularios inline (ej: Tags y Categorías) ===== */
.form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-inline input[type="text"] {
    flex: 1; /* el input se estira ocupando todo */
}

.form-inline button {
    width: auto; /* 👈 el botón ocupa solo lo necesario */
    padding: 9px 16px;
    border-radius: 6px;
    background: #ff004a;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: background 0.3s ease;
}

.form-inline button:hover {
    background: #e00040;
}

.form-block input, .form-block select {
    width: 20%;
}

.form-block button {
    width: 10%;
}

.button-link {
    background: #ff004a;
    padding: 7px;
    width: 33px;
    text-align: center;
    border-radius: 20px;
    color: #FFF;
    font-weight: bold;
    transition: background 0.3s ease;
    cursor: pointer;
    font-size: 18px;
}

.button-link:hover {
    background: #e00040 ;
}

table tr td a {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

.container p {
    text-align: center;
}

.back-link {
    font-size: 0.8em;
    color: #333;
    text-decoration: none;
}

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

}

/* ===== Comentarios ===== */

#comentarios-list {
    font-size: 14px;
    border-top: 1px solid #DDD;
    margin-top: 10px;
}

.box-comentarios {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.box-comentarios button {
    width: 200px;
    max-height: 50px;
}

.input-comentar {
    padding: 8px;
    margin: 5px 0;
    width: 100%;
    border-radius: 6px;
    border: 1px solid #ccc;
    color: #888;
    font-family: system-ui, -apple-system, Arial, sans-serif;
}

.input-comentar:focus {
    outline: 2px solid #ff004a; /* color corporativo */
    border-color: #ff004a;      /* cambia el borde */
    box-shadow: 0 0 5px rgba(255, 0, 74, 0.6); /* opcional: efecto glow */
}


/* ===== Tablas responsive ===== */
@media (max-width: 600px) {
    table, thead, tbody, th, td, tr {
        display: block;
        width: 100%;
        border: none;
        background: none;
        margin-top: 0;
    }

    thead {
        display: none;
    }

    tr {
        background: #fff;
        padding: 0;
        margin: 0;
        padding: 7px 0;
        padding-bottom: 9px;
        border-top: 1px solid #DDD;
        display: flex;
        justify-content: space-between;
    }

    .table-recursos tr {
        display: block;
    }

    .container h2 {
        font-size: 120%;
        margin-bottom: 0;
    }

    .box {
        margin-bottom: 14px;
    }

    tr:last-child {
        border-bottom: 1px solid #DDD;
    }

    .table-recursos tr:first-child {
        border-top: 0;
        padding-top: 0;
    }

    .table-recursos tr:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    td {
        border: none !important;
        position: relative;
        padding: 0 !important;
    }

    td:before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-top: 4px;
        color: #ff004a; /* tu color corporativo */
    }

    td:last-child {
        text-align: right;
    }

    .button-link span {
        display:  none;
    }

    .box-title a.button-link {
        font-size: 16px;
        display: block;
        width: 28px;
        padding: 5px;
        text-decoration: none;
        
    }

    .button-link {
        width: 25px;
        padding: 5px;
        font-size: 14px;
    }
}

html, body {
    height: 100%;
}

/* Para todas las páginas de la app */
body.app-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* ocupa todo el alto */
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 1200px;   /* 👈 asegura ancho completo */
}

.box {
    display: flex;
    flex-direction: column;
    width: 100%;   /* 👈 ocupa el 100% del container */
    box-sizing: border-box;
}

/* Footer */
.user-info {
    font-size: 14px;
    width: 100%;
    text-align: center;
    background: #333;
    padding: 10px;
    color: #DDD;
}

/* ===== Tablas responsive ===== */
@media (max-width: 600px) {

    .login-box {
        width: 80% !important;   /* ocupa todo el ancho */
        max-width: none !important; /* ignora el 320px */
        margin: 0;                /* sin márgenes */
        border-radius: 10px;          /* opcional: sin bordes redondeados */
        height: 40%;             /* opcional: ocupa toda la pantalla */
        display: flex;
        flex-direction: column;
        justify-content: center;   /* centra el contenido */
    }

    .login-box h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .login-box input,
    .login-box button {
        font-size: 16px;
        padding: 14px;
    }

    .container {
        width: 100%;
    }

    header {
        display: inline;
        justify-content: space-between;
    }

    nav {
    display: none; /* oculto por defecto en mobile */
    flex-direction: column;
    border-top: 1px solid #cd003c;;
    }

    nav a {
        color: #fff;
        text-decoration: none;
        font-size: 14px;
        padding: 8px 18px;
        font-weight: normal;
        border-bottom: 1px solid #cd003c;
        border-radius: 0;
    }

    nav.active {
        display: flex;
    }

    /* Ocultar en mobile */
    .desktop-only {
        display: none;
    }

    .desktop-only-table {
        display: none;
    }
}

/* En pantallas grandes siempre visible, sin animación */
@media (min-width: 768px) {
    nav {
        flex-direction: row;
        max-height: none; /* sin límite */
        opacity: 1;       /* siempre visible */
    }
}
