/* styles.css - Estilo WordPress con Sidebar */
:root {
    --primary: #007cba;
    --primary-dark: #006ba1;
    --secondary: #6c757d;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --dark: #2c3338;
    --light: #f8f9fa;
    --sidebar-width: 250px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    background-color: #f0f0f1;
    color: #3c434a;
    line-height: 1.6;
}

/* Layout Principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Estilo WordPress */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #3c434a;
    background: #1d2327;
}

.sidebar-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-header .user-info {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 10px;
}

/* Menú de Navegación */
.list-unstyled {
    padding: 0;
    margin: 0;
    list-style: none;
}

.list-unstyled li {
    border-bottom: 1px solid #3c434a;
}

.list-unstyled li:last-child {
    border-bottom: none;
}

.list-unstyled li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #c3c4c7;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.list-unstyled li a:hover {
    background: #2c3338;
    color: white;
    border-left-color: var(--primary);
}

.list-unstyled li a i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.list-unstyled li.active a {
    background: #2c3338;
    color: white;
    border-left-color: var(--primary);
}

/* Footer del Sidebar */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #3c434a;
    margin-top: auto;
}

.sidebar-footer a {
    color: #c3c4c7;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.sidebar-footer a:hover {
    color: white;
}

.sidebar-footer a i {
    margin-right: 8px;
}

/* Contenido Principal */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    min-height: 100vh;
}

/* Header del Contenido */
.content-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: between;
    align-items: center;
}

.content-header h1 {
    color: var(--dark);
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

/* Tarjetas de Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.primary { border-left-color: var(--primary); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }

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

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

/* Sistema de Pestañas */
.tabs-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab {
    padding: 15px 25px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--secondary);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    color: var(--primary);
    background: white;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
}

.tab-content {
    display: none;
    padding: 25px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Formularios */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Área de Upload */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #e7f3ff;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: #d1ecff;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--secondary);
}

.file-info {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 10px;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    margin-top: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: none;
}

/* Botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Filtros y Búsqueda */
.filters-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.search-section {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

/* Tabla */
.table-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.table th {
    background: #f8f9fa;
    padding: 15px;
    font-weight: 600;
    color: var(--dark);
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.9rem;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges de Estado */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-ok {
    background: #d4edda;
    color: #155724;
}

.status-nr {
    background: #fff3cd;
    color: #856404;
}

.status-empty {
    background: #f8d7da;
    color: #721c24;
}

/* Acciones */
.actions-cell {
    display: flex;
    gap: 5px;
}

.btn-edit, .btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.btn-edit:hover {
    background: #856404;
    color: white;
}

.btn-delete {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.btn-delete:hover {
    background: #721c24;
    color: white;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.pagination-info {
    color: var(--secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 5px;
}

.pagination-controls button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination-controls button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Estado de la Base de Datos */
.db-status {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.db-connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.db-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Mensajes */
.message {
    padding: 12px 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f1;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 5px;
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .search-section {
        flex-direction: column;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs-header {
        flex-direction: column;
    }
    
    .tab {
        text-align: left;
        border-bottom: 1px solid #dee2e6;
        border-left: 3px solid transparent;
    }
    
    .tab.active {
        border-left-color: var(--primary);
        border-bottom-color: #dee2e6;
    }
    
    .pagination {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .login-card {
        padding: 30px 20px;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}