/* ============================================
   PORTAL CHF - ESTILOS PRINCIPALES
   ============================================ */

/* Variables CSS */
:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --bg-overlay: rgba(255, 255, 255, 0.1);
    --bg-overlay-hover: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #000;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.authenticated {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    background-image: url('../assets/background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    position: relative;
}

body.authenticated::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(40, 30, 50, 0.75) 0%, 
        rgba(30, 20, 40, 0.75) 100%
    );
    backdrop-filter: blur(8px);
    z-index: -1;
}

/* Contenedor Principal */
.main-content {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

body.authenticated .main-content {
    display: block;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    margin-bottom: 6px;
    padding: 8px 0;
    color: white;
}

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

.header-table td {
    padding: 4px 10px;
    vertical-align: middle;
}

.header-logo-cell {
    width: 155px;
    text-align: left;
}

.header-title-cell {
    text-align: center;
}

.header-controls-cell {
    width: 250px;
    text-align: right;
}

.admin-logo {
    width: 140px;
    height: 99px;
    cursor: pointer;
    transition: transform var(--transition-speed) ease;
}

.admin-logo:hover {
    transform: scale(1.05);
}

.admin-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.8rem;
    margin-top: 2px;
    opacity: 1;
    font-weight: 400;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* Controles del Header */
.header-controls {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

/* Búsqueda - integrada en fila de filtros */
.search-container {
    display: none;
}

/* Barra única: filtros + búsqueda */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.search-input {
    padding: 5px 14px;
    font-size: 0.8rem;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    color: white;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
    min-width: 180px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
    outline: none;
    background: var(--bg-overlay-hover);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Categorías + búsqueda en la misma fila */
.categories {
    display: flex;
    gap: 6px;
    margin-bottom: 0;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.category-btn {
    padding: 5px 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
}

.category-btn:hover {
    background: var(--bg-overlay-hover);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-btn.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
}

/* Controles de Categorías */
.category-controls {
    text-align: center;
    margin-bottom: 20px;
}

.category-actions-row {
    margin-bottom: 15px;
}

.add-category-btn {
    padding: 12px 24px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-md);
}

.add-category-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.category-action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.category-action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
}

.category-edit-btn {
    background: var(--warning-color);
    color: white;
}

.category-edit-btn:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.category-delete-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Grid de Tarjetas */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .categories {
        justify-content: center;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
}
