/* ===================================
   ESTILOS GLOBALES
   =================================== */

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

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

/* ===================================
   NAVEGACIÓN
   =================================== */

.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.navbar h1 {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.btn-logout,
.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.3s;
    display: inline-block;
}

.btn-logout:hover,
.btn-back:hover {
    background: rgba(255,255,255,0.3);
}

/* ===================================
   CONTENEDORES
   =================================== */

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

.card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

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

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f7fa;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-view {
    background: #667eea;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-view:hover {
    background: #5568d3;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

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

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

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.helper-text {
    font-size: 13px;
    color: #999;
    margin-top: 5px;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

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

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

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

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

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

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* ===================================
   TARJETAS Y ESTADÍSTICAS
   =================================== */

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

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s;
}

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

.stat-card .icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-card .label {
    color: #666;
    font-size: 14px;
}

/* ===================================
   TARJETAS DE ACCIÓN
   =================================== */

.action-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.action-card .icon {
    font-size: 50px;
    margin-bottom: 15px;
}

.action-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 20px;
}

.action-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

/* ===================================
   LISTAS DE ACUERDOS
   =================================== */

.agreement-list {
    list-style: none;
}

.agreement-item {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.agreement-item:last-child {
    border-bottom: none;
}

.agreement-item:hover {
    background: #f5f7fa;
}

.agreement-info h4 {
    color: #333;
    margin-bottom: 5px;
    font-size: 16px;
}

.agreement-info p {
    color: #999;
    font-size: 13px;
}

/* ===================================
   PASOS (WIZARD)
   =================================== */

.steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    background: #f5f7fa;
    padding: 0 10px;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.step.active .step-circle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.step.completed .step-circle {
    background: #4caf50;
    color: white;
}

.step-label {
    font-size: 12px;
    color: #666;
}

/* ===================================
   ACUERDOS - PREVIEW Y VISUALIZACIÓN
   =================================== */

.agreement-preview {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    margin-bottom: 30px;
    white-space: pre-wrap;
    line-height: 1.8;
    max-height: 600px;
    overflow-y: auto;
}

.agreement-header {
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.agreement-header h2 {
    color: #333;
    margin-bottom: 10px;
}

.agreement-meta {
    color: #666;
    font-size: 14px;
}

.agreement-body {
    line-height: 1.8;
    white-space: pre-wrap;
    color: #333;
}

.agreement-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ===================================
   FEEDBACK BOX
   =================================== */

.feedback-box {
    background: #fff9e6;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #ffeaa7;
}

.feedback-box h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

/* ===================================
   ESTADOS VACÍOS
   =================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.empty-state p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ===================================
   LOADING / SPINNER
   =================================== */

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.login-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 100%;
    animation: slideIn 0.5s ease;
}

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

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

.logo-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.logo h1 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
    line-height: 1.6;
}

.demo-credentials {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 13px;
    color: #666;
}

.demo-credentials strong {
    color: #667eea;
}

.demo-credentials code {
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.philosophy {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #888;
    line-height: 1.8;
}

.philosophy-item {
    margin: 5px 0;
}

/* ===================================
   WELCOME CARD
   =================================== */

.welcome-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.welcome-card h2 {
    color: #333;
    margin-bottom: 15px;
}

.welcome-card p {
    color: #666;
    line-height: 1.6;
}

/* ===================================
   RECENT AGREEMENTS
   =================================== */

.recent-agreements {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.recent-agreements h3 {
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===================================
   SIDEBAR (para ver-acuerdos.php)
   =================================== */

.sidebar {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
}

.sidebar h3 {
    color: #333;
    margin-bottom: 20px;
}

.sidebar .agreement-item {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border: 2px solid transparent;
}

.sidebar .agreement-item:hover {
    background: #f5f7fa;
}

.sidebar .agreement-item.active {
    background: #e8ecff;
    border-color: #667eea;
}

.sidebar .agreement-item h4 {
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.sidebar .agreement-item p {
    color: #999;
    font-size: 12px;
}

/* ===================================
   LAYOUT DE 2 COLUMNAS
   =================================== */

.two-column-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

.content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        text-align: center;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .two-column-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 2;
    }
    
    .content {
        order: 1;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .agreement-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card {
        padding: 20px;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    body {
        background: white;
    }
    
    .navbar,
    .sidebar,
    .agreement-actions,
    .btn,
    .actions {
        display: none !important;
    }
    
    .container,
    .two-column-layout {
        display: block;
        max-width: 100%;
    }
    
    .content,
    .card {
        box-shadow: none;
        padding: 0;
    }
    
    .agreement-preview {
        border: none;
        background: white;
    }
}

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

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

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

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

        /* Estilos para el visor de Markdown */
        .markdown-body {
            box-sizing: border-box;
            min-width: 200px;
            max-width: 100%;
            padding: 30px;
            background: #ffffff;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            margin-bottom: 30px;
        }
        
        .markdown-body h1 {
            border-bottom: 2px solid #667eea;
            padding-bottom: 10px;
            color: #667eea;
        }
        
        .markdown-body h2 {
            border-bottom: 1px solid #e0e0e0;
            padding-bottom: 8px;
            color: #764ba2;
            margin-top: 30px;
        }
        
        .markdown-body h3 {
            color: #667eea;
            margin-top: 20px;
        }
        
        .markdown-body ul,
        .markdown-body ol {
            padding-left: 30px;
        }
        
        .markdown-body li {
            margin: 10px 0;
        }
        
        .markdown-body strong {
            color: #333;
        }
        
        .markdown-body blockquote {
            border-left: 4px solid #667eea;
            padding-left: 20px;
            color: #666;
            font-style: italic;
            background: #f8f9fa;
            margin: 20px 0;
            padding: 15px 20px;
            border-radius: 5px;
        }
        
        .markdown-body code {
            background: #f5f7fa;
            padding: 2px 6px;
            border-radius: 3px;
            font-family: 'Courier New', monospace;
            color: #667eea;
        }
        
        .markdown-body hr {
            border: none;
            border-top: 2px solid #e0e0e0;
            margin: 30px 0;
        }
        
        .markdown-body table {
            border-collapse: collapse;
            width: 100%;
            margin: 20px 0;
        }
        
        .markdown-body table th,
        .markdown-body table td {
            border: 1px solid #e0e0e0;
            padding: 12px;
            text-align: left;
        }
        
        .markdown-body table th {
            background: #f5f7fa;
            font-weight: bold;
            color: #667eea;
        }
        
        /* Ajustes para imprimir */
        @media print {
            .btn, .feedback-box, .navbar {
                display: none !important;
            }
            
            .markdown-body {
                border: none;
                box-shadow: none;
            }
        }
