/**
 * ============================================
 * GESTDOC ADMIN CSS (Versión Definitiva)
 * ============================================
 */

.gestdoc-admin-wrapper {
    width: 95%;
    max-width: 95%;
    margin: 20px auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    box-sizing: border-box;
}

/* ============================================
   CABECERA
============================================ */

.gestdoc-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.gestdoc-main-title {
    margin: 0;
    padding: 0;
    color: #2271b1;
    font-size: 26px;
    line-height: 1.2;
}

.gestdoc-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gestdoc-btn-cerrar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease;
    color: #fff;
    background: #dc3545;
}

.gestdoc-btn-cerrar:hover {
    background: #c82333;
}

/* ============================================
   TABS / PESTAÑAS
============================================ */

.gestdoc-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid #c3c4c7;
    margin: 20px 0 0;
    position: relative;
}

.gestdoc-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #50575e;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 4px 4px 0 0;
    transition: all 0.2s ease;
    margin-bottom: -1px;
    white-space: nowrap;
}

.gestdoc-tab.active {
    background: #ffffff;
    color: #2271b1;
    border-bottom: 1px solid #ffffff;
    font-weight: 600;
}

.gestdoc-tab:hover {
    background: #ffffff;
    color: #2271b1;
}

/* ============================================
   CONTENIDO GENERAL Y ALERTAS VERDES/ROJAS
============================================ */

.gestdoc-content-wrapper {
    padding: 20px 0;
}

.gestdoc-success {
    background: #d4edda !important;
    color: #155724 !important;
    padding: 12px 15px !important;
    border-radius: 5px !important;
    margin-bottom: 20px !important;
    border-left: 4px solid #28a745 !important;
    font-size: 14px;
}

.gestdoc-error {
    background: #f8d7da !important;
    color: #721c24 !important;
    padding: 12px 15px !important;
    border-radius: 5px !important;
    margin-bottom: 20px !important;
    border-left: 4px solid #dc3545 !important;
    font-size: 14px;
}

/* ============================================
   MAQUETACIÓN SECCIÓN: LISTA DOCUMENTOS
============================================ */

/* Contenedor del Formulario de Filtros */
.gestdoc-filter-form {
    background: #f6f7f7;
    padding: 15px 20px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.gestdoc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gestdoc-filter-group label {
    font-weight: 600;
    color: #1d2327;
    font-size: 13px;
    margin-bottom: 0;
}

.gestdoc-filter-select {
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background-color: #fff;
    min-width: 200px;
    color: #2c3338;
    height: 38px;
    font-size: 14px;
}

/* Grupo para botones - CORREGIDO */
.gestdoc-filter-group-buttons {
    display: flex;
    gap: 10px;
    /*align-items: center;*/
    padding-top: 22px; /* Esto alinea los botones con los selects */
}

/* Botón Filtrar */
.gestdoc-btn-filtrar {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 0 24px;
    height: 38px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.gestdoc-btn-filtrar:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.gestdoc-btn-filtrar:active {
    transform: translateY(0);
}

/* Botón Limpiar filtros */
.gestdoc-btn-limpiar {
    background: #28a745;
    color: #fff !important;
    padding: 0 24px;
    height: 38px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.gestdoc-btn-limpiar:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #fff !important;
}

.gestdoc-btn-limpiar:active {
    transform: translateY(0);
}

/* Estilos para la Tabla */
.gestdoc-docs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: #ffffff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    overflow: hidden;
}

.gestdoc-docs-table th {
    background: #f8f9fa;
    color: #1d2327;
    font-weight: 600;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #c3c4c7;
    font-size: 14px;
}

.gestdoc-docs-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e4e7;
    color: #2c3338;
    font-size: 13px;
    vertical-align: middle;
}

.gestdoc-docs-table tr:hover td {
    background: #f6f7f7;
}

/* ============================================
   BOTONES DE ACCIONES EN TABLA
============================================ */

/* Botón Descargar */
.gestdoc-link-descargar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #28a745;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-right: 8px;
    border: none;
    cursor: pointer;
}

.gestdoc-link-descargar:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #fff !important;
    text-decoration: none !important;
}

.gestdoc-link-descargar:active {
    transform: translateY(0);
}

/* Botón Eliminar */
.gestdoc-link-eliminar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dc3545;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.gestdoc-link-eliminar:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #fff !important;
    text-decoration: none !important;
}

.gestdoc-link-eliminar:active {
    transform: translateY(0);
}

/* ============================================
   MODAL
============================================ */

.gestdoc-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.gestdoc-modal-content {
    background: #ffffff !important;
    padding: 30px !important;
    border-radius: 8px !important;
    border: 1px solid #c3c4c7 !important;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2) !important;
    text-align: center;
    margin: auto;
}

.gestdoc-modal-content h3 {
    color: #dc3545;
    margin: 0 0 12px 0;
    font-size: 20px;
}

.gestdoc-modal-content p {
    color: #50575e;
    font-size: 14px;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.gestdoc-modal-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.gestdoc-modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s;
}

#modal_doc_btn_confirmar {
    background: #dc3545;
    color: white;
}

#modal_doc_btn_confirmar:hover {
    background: #bd2130;
}

#modal_doc_btn_cancelar {
    background: #6c757d;
    color: white;
}

#modal_doc_btn_cancelar:hover {
    background: #5a6268;
}

.gestdoc-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: gestdoc-spin 0.8s linear infinite;
    margin-right: 6px;
}

@keyframes gestdoc-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   BADGES
============================================ */

.gestdoc-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.gestdoc-badge-nuevo {
    background: #d4edda;
    color: #155724;
}

.gestdoc-badge-antiguo {
    background: #e2e3e5;
    color: #383d41;
}

/* ============================================
   PAGINACIÓN
============================================ */

.gestdoc-pagination {
    margin-top: 20px;
    text-align: center;
}

.gestdoc-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    background: #f0f0f1;
    color: #2271b1;
    text-decoration: none;
    border-radius: 4px;
}

.gestdoc-pagination .page-numbers.current {
    background: #2271b1;
    color: white;
}

.gestdoc-pagination .page-numbers:hover {
    background: #2271b1;
    color: white;
}

/* ============================================
   RESPONSIVE
============================================ */

@media (max-width: 991px) {
    .gestdoc-admin-wrapper {
        width: 98%;
        padding: 15px;
    }
    .gestdoc-main-title {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    .gestdoc-admin-wrapper {
        width: 98%;
        padding: 10px;
        border-radius: 0;
    }

    .gestdoc-header-flex {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .gestdoc-header-actions {
        width: 100%;
        flex-direction: column;
    }

    .gestdoc-btn-cerrar {
        width: 100%;
    }

    .gestdoc-tabs-nav {
        flex-wrap: wrap !important;
        gap: 6px 4px !important;
    }
    
    .gestdoc-tab {
        flex: 1 1 auto !important;
        white-space: normal !important;
        text-align: center;
        padding: 10px 12px !important;
        font-size: 13px !important;
        border-radius: 4px !important;
        margin-bottom: 0 !important;
    }

    .gestdoc-tab.active {
        border-color: #2271b1 !important;
        background: #2271b1 !important;
        color: #ffffff !important;
    }

    .gestdoc-filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .gestdoc-filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .gestdoc-filter-select {
        width: 100%;
    }

	.gestdoc-filter-group-buttons {
        padding-top: 0;
        flex-direction: column;
        width: 100%;
    }

    .gestdoc-btn-filtrar, 
    .gestdoc-btn-limpiar {
        width: 100%;
        justify-content: center;
    }

    /* Tabla modo tarjetas */
    .gestdoc-docs-table {
        display: block;
        border: none;
    }

    .gestdoc-docs-table thead {
        display: none;
    }

    .gestdoc-docs-table tr {
        display: block;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 12px;
        margin-bottom: 12px;
        border: 1px solid #c3c4c7;
        border-radius: 6px;
        background: #fff;
    }

    .gestdoc-docs-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px dashed #e2e4e7;
    }

    .gestdoc-docs-table td:last-child {
        border-bottom: none;
        justify-content: center;
        gap: 20px;
        padding-top: 12px;
    }

    .gestdoc-docs-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #1d2327;
    }

    .gestdoc-docs-table td:last-child::before {
        content: "";
    }
    
    /* Botones en móvil dentro de la tabla */
    .gestdoc-link-descargar,
    .gestdoc-link-eliminar {
        padding: 6px 12px;
        font-size: 12px;
    }
}
