/* styles.css - Estilos modernos y responsivos para P.I.R.E.R.A.S */

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #5f0416;
    --primary-dark: #33021e;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --info-color: #2196f3;
    --light-bg: #f8f9fc;
    --white: #ffffff;
    --text-dark: #2d3436;
    --text-muted: #636e72;
    --border-color: #e9ecef;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --border-radius-sm: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #4a0b2f 0%, #27000e 100%);
    min-height: 100vh;
}

/* Login y páginas principales */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.logo h1 {
    color: var(--text-dark);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Selección de roles */
.role-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.role-card {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: var(--transition);
}

.role-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.role-card:hover::before {
    opacity: 1;
}

.role-card:hover * {
    color: var(--white) !important;
    z-index: 1;
    position: relative;
}

.role-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.role-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.role-card p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Dashboard Layout */
.dashboard-body {
    background: var(--light-bg);
    min-height: 100vh;
    padding: 0;
}

.dashboard-header {
    background: var(--white);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.user-info h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.user-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.logout-btn {
    background: var(--danger-color) !important;
    color: var(--white) !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.logout-btn:hover {
    background: #d32f2f !important;
    transform: translateY(-1px);
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.dashboard-title {
    text-align: center;
    color: var(--text-dark);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    font-size: 1.5rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    height: 3rem;
}

.card h3 {
    color: var(--text-dark);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--text-dark);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn, button[type="submit"] {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.btn:hover, button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    filter: brightness(1.05);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    width: auto;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #45a049);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #e68900);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #d32f2f);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #1976d2);
}

/* Lists y contenido dinámico */
.content-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
}

.list-item {
    background: var(--light-bg);
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--primary-color);
    position: relative;
}

.item-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.item-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.item-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-top: 4px solid var(--primary-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Alertas */
.alert {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    color: var(--white);
    font-weight: 500;
    z-index: 1000;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: var(--success-color);
}

.alert-error {
    background: var(--danger-color);
}

.alert-info {
    background: var(--info-color);
}

.alert-warning {
    background: var(--warning-color);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    width: auto;
}

.modal-close:hover {
    color: var(--text-dark);
}

/* Utilidades */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 0 1rem 1rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .role-selector {
        grid-template-columns: 1fr;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .alert {
        position: fixed;
        top: 1rem;
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    
    .modal {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .item-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .user-info h2 {
        font-size: 1.2rem;
    }
}

/* Loading states */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    color: var(--white);
}

.badge-success { background: var(--success-color); }
.badge-warning { background: var(--warning-color); }
.badge-danger { background: var(--danger-color); }
.badge-info { background: var(--info-color); }
.badge-primary { background: var(--primary-color); }