/* =============================================
   VARIABLES Y RESET
   ============================================= */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #16a085;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --gray-color: #95a5a6;
    
    --border-radius: 6px;
    --transition: all 0.3s ease;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* =============================================
   PÁGINA DE LOGIN
   ============================================= */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 28px;
}

.login-header p {
    color: var(--gray-color);
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--light-color);
    color: var(--gray-color);
    font-size: 13px;
}

/* =============================================
   FORMULARIOS
   ============================================= */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background-color: #fafbfc;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-control::placeholder {
    color: #bbb;
}

textarea.form-control {
    resize: vertical;
    font-family: inherit;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.form-row .form-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-section {
    padding: 25px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    border-left: 4px solid var(--secondary-color);
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 18px;
}

.form-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 16px;
    margin-top: 20px;
}

/* =============================================
   BOTONES
   ============================================= */

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary:hover {
    background-color: #2980b9;
}

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

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

.btn-success:hover {
    background-color: #229954;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

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

.btn-warning:hover {
    background-color: #e67e22;
}

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

.btn-info:hover {
    background-color: #1abc9c;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-plantilla {
    display: inline-block;
    padding: 10px 15px;
    margin: 5px 5px 5px 0;
    background-color: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--primary-color);
    transition: var(--transition);
}

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

/* =============================================
   HEADER Y SIDEBAR
   ============================================= */

header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 22px;
    font-weight: bold;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--dark-color);
    color: white;
    padding-top: 70px;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: block;
    padding: 15px 25px;
    color: #ecf0f1;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 14px;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--secondary-color);
    color: white;
}

.sidebar-menu a.active {
    background-color: var(--secondary-color);
    border-left-color: var(--secondary-color);
    color: white;
}

/* =============================================
   CONTENIDO PRINCIPAL
   ============================================= */

.main-content {
    margin-left: 250px;
    padding: 30px 0;
    min-height: calc(100vh - 80px);
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.page-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 28px;
}

.page-header p {
    color: var(--gray-color);
    margin: 5px 0 0 0;
}

/* =============================================
   TARJETAS
   ============================================= */

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    background-color: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.card-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

/* Dashboard Stats */
.stat-card {
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 15px 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    padding: 0 20px;
}

/* =============================================
   ALERTAS
   ============================================= */

.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #27ae60;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #e74c3c;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left-color: #f39c12;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left-color: #16a085;
}

/* =============================================
   TABLAS
   ============================================= */

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead {
    background-color: #f8f9fa;
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid #ecf0f1;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
}

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

.table-striped tbody tr:nth-child(odd) {
    background-color: #fafbfc;
}

/* =============================================
   BADGES
   ============================================= */

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* =============================================
   MODALES
   ============================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

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

.modal.show {
    display: block;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ecf0f1;
    text-align: right;
}

.close {
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    color: #999;
    border: none;
    background: none;
    padding: 0;
}

.close:hover {
    color: #000;
}

/* =============================================
   PLANTILLAS
   ============================================= */

.plantillas-section {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    border: 1px solid #ecf0f1;
}

.plantillas-grupo {
    margin-bottom: 20px;
}

.plantillas-grupo h5 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.plantillas-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* =============================================
   GRID Y LAYOUT
   ============================================= */

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 25px;
}

.col-lg-8 {
    grid-column: span 2;
}

.col-lg-4 {
    grid-column: span 1;
}

.col-md-6 {
    grid-column: span 1;
}

@media (max-width: 992px) {
    .col-lg-8,
    .col-lg-4 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        padding-top: 70px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header h1 {
        margin-bottom: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 576px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: var(--transition);
        width: 100%;
        z-index: 1001;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .user-menu {
        gap: 10px;
        font-size: 12px;
    }
}

/* =============================================
   UTILIDADES
   ============================================= */

.text-muted {
    color: var(--gray-color);
}

.text-small {
    font-size: 12px;
}

.text-warning {
    color: var(--warning-color);
}

.text-center {
    text-align: center;
}

.quick-access {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 30px 20px;
}

.quick-access .btn {
    flex: 1;
    min-width: 150px;
}

.registro-card {
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
    margin-bottom: 10px;
}

.registro-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.registro-card strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #ecf0f1;
}

.form-actions .btn {
    flex: 1;
}

/* =============================================
   FOOTER
   ============================================= */

footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 50px;
}

footer p {
    margin: 0;
    font-size: 14px;
}