/* ============================================
   ESTILOS PARA PÁGINAS DE ADMINISTRACIÓN
   ============================================ */

:root {
    --color-Principal: #002a7f;
    --color-Secundario: #a3bd36;
    --color-NeutroFuerte: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: var(--color-NeutroFuerte);
    min-height: 100vh;
}

.admin-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.admin-header {
    background: linear-gradient(135deg, var(--color-Principal) 0%, #001a4d 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 42, 127, 0.2);
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-nav {
    display: flex;
    gap: 8px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-Principal);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.9);
    transition: all 0.15s ease;
}

.admin-nav a img {
    width: 18px;
    height: 18px;
}

.admin-nav a:hover {
    background-color: white;
    color: var(--color-Secundario);
    transform: translateY(-1px);
}

.admin-nav a.active {
    background-color: var(--color-Secundario);
    color: var(--color-Principal);
}

/* Main Content */
.admin-main {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Toolbar */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.btn-primary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    color: var(--color-Principal);
    border: 0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    color: var(--color-Secundario);
    background-color: rgba(163, 189, 54, 0.08);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    color: var(--color-Principal);
    border: 0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    color: var(--color-Secundario);
    background-color: rgba(163, 189, 54, 0.08);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-danger {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    color: #dc3545;
    border: 0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-danger:hover {
    color: #a71d2a;
    background-color: rgba(220, 53, 69, 0.08);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: scale(0.97);
}

/* Botones estilo admin (como Generar/Template) */
.btn-admin {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    color: var(--color-Principal);
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: var(--fuente-Principal);
    transition: all 0.15s ease;
}

.btn-admin img {
    width: 18px;
    height: 18px;
}

.btn-admin:hover {
    color: var(--color-Secundario);
    background-color: rgba(163, 189, 54, 0.08);
    transform: translateY(-1px);
}

.btn-admin:active {
    transform: scale(0.97);
}

.btn-admin-danger {
    color: #dc3545;
}

.btn-admin-danger:hover {
    color: #a71d2a;
    background-color: rgba(220, 53, 69, 0.08);
}

/* Botones solo icono para tabla */
.btn-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    border: 0;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon img {
    width: 20px;
    height: 20px;
}

.btn-icon:hover {
    background-color: rgba(163, 189, 54, 0.15);
    transform: scale(1.1);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn-icon-danger:hover {
    background-color: rgba(220, 53, 69, 0.15);
}

/* Modal Base */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-overlay .modal-content .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    background: white !important;
    border-radius: 12px 12px 0 0;
    color: var(--color-Principal);
}

.modal-overlay .modal-content .modal-header h2 {
    font-size: 1.2rem;
    color: var(--color-Principal);
    margin: 0;
    font-weight: 600;
}

.modal-overlay .modal-body {
    padding: 24px;
}

.modal-overlay .modal-body p {
    margin: 0 0 12px 0;
    line-height: 1.5;
    color: #333;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.modal-btn-cancel {
    background-color: #f0f0f0;
    color: #666;
}

.modal-btn-cancel:hover {
    background-color: #e0e0e0;
}

/* Modal pequeño para confirmaciones */
.modal-small {
    max-width: 400px;
}

.modal-btn-danger {
    background-color: #dc3545;
    color: white;
}

.modal-btn-danger:hover {
    background-color: #a71d2a;
}

.text-danger {
    color: #dc3545;
    font-size: 0.85rem;
}

.loading-cell {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Table */
.admin-table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: auto;
}

.admin-table thead {
    background-color: #f8f9fa;
}

.admin-table th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--color-Principal);
    border-bottom: 2px solid var(--color-Secundario);
    white-space: nowrap;
    min-width: 80px;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    text-align: left;
}

.admin-table tbody tr:hover {
    background-color: #f8f9fa;
}

.loading-cell {
    text-align: center;
    color: #888;
    padding: 40px !important;
}

/* Action Buttons */
.btn-action {
    background: none;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-edit {
    color: var(--color-Principal);
}

.btn-edit:hover {
    background-color: rgba(0, 42, 127, 0.1);
}

.btn-delete {
    color: #dc3545;
}

.btn-delete:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

/* Tags/Badges */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
}

.tag-diario {
    background-color: rgba(0, 42, 127, 0.1);
    color: var(--color-Principal);
}

.tag-mensual {
    background-color: rgba(163, 189, 54, 0.2);
    color: #6b7d1a;
}

/* Modal Admin */
.modal-admin {
    width: 600px;
    max-width: 95vw;
}

.modal-admin .modal-body {
    padding: 24px;
}

/* Form Styles */
.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-NeutroFuerte);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-Principal);
    box-shadow: 0 0 0 3px rgba(0, 42, 127, 0.1);
}

.form-group input[readonly] {
    background-color: #f5f5f5;
    color: #666;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #888;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    gap: 20px;
    padding: 10px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Modal Button Primary */
.modal-btn-primary {
    background-color: var(--color-Principal);
    color: white;
}

.modal-btn-primary:hover {
    background-color: #001a4d;
}

/* Status Messages */
.status-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.status-success {
    background-color: rgba(163, 189, 54, 0.15);
    color: #5a6b1a;
    border: 1px solid rgba(163, 189, 54, 0.3);
}

.status-error {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Path column */
.path-cell {
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    color: #666;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-toolbar {
        flex-wrap: wrap;
    }
}
