/**
 * PORTAL MAZZA - CSS
 * portal.marcelomazza.info
 */

:root {
    --primary: #d4a574;
    --primary-dark: #b8956a;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --info: #3b82f6;
    --secondary: #6b7280;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --color-success: var(--success);
    --color-warning: var(--warning);
    --color-danger: var(--danger);
    --color-info: var(--info);
    --color-primary: var(--primary);
    --color-gray: var(--gray-500);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== HEADER ========== */
.portal-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray-800);
    font-weight: 700;
    font-size: 1.1rem;
}

.logo i {
    color: var(--primary);
    font-size: 1.4rem;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
}

.btn-logout {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--gray-500);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--gray-100);
    color: var(--danger);
}

/* ========== MAIN ========== */
.portal-main {
    flex: 1;
    padding: 24px;
}

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

/* ========== FOOTER ========== */
.portal-footer {
    background: var(--gray-800);
    color: var(--gray-400);
    padding: 24px;
    text-align: center;
    font-size: 0.85rem;
}

.portal-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ========== PAGE HEADER ========== */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.back-link:hover {
    color: var(--primary);
}

/* ========== CARDS ========== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--gray-400);
}

.card-body {
    padding: 20px;
}

/* ========== OPERACIONES GRID ========== */
.operaciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.operacion-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    overflow: hidden;
}

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

.operacion-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
}

.operacion-body {
    padding: 20px;
}

.operacion-direccion {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-800);
}

.operacion-unidad {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.operacion-precio {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.operacion-meta {
    display: flex;
    gap: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.operacion-footer {
    padding: 12px 20px;
    background: var(--gray-50);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.operacion-codigo {
    font-size: 0.8rem;
    color: var(--gray-400);
    font-family: monospace;
}

/* ========== OPERACION DETAIL ========== */
.operacion-detail-header {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.operacion-detail-info h1 {
    font-size: 1.5rem;
    margin-top: 8px;
}

.operacion-detail-precio {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.operacion-detail-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
}

/* ========== ETAPAS ========== */
.etapas-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.etapa-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    position: relative;
}

.etapa-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 48px;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.etapa-item.completada:not(:last-child)::after {
    background: var(--success);
}

.etapa-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--gray-200);
    color: var(--gray-500);
}

.etapa-item.completada .etapa-marker {
    background: var(--success);
    color: white;
}

.etapa-item.actual .etapa-marker {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.2);
}

.etapa-content {
    flex: 1;
}

.etapa-nombre {
    font-weight: 500;
    display: block;
}

.etapa-fecha, .etapa-estado {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.etapa-item.actual .etapa-estado {
    color: var(--primary);
    font-weight: 500;
}

/* ========== DOCUMENTOS ========== */
.documentos-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.documento-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.documento-icon {
    width: 40px;
    height: 40px;
    background: #fee2e2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
}

.documento-info {
    flex: 1;
}

.documento-nombre {
    font-weight: 500;
    display: block;
}

.documento-fecha {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ========== INFO LISTA ========== */
.info-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.info-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.info-valor {
    font-weight: 500;
}

/* ========== MINI TIMELINE ========== */
.mini-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.timeline-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    flex-shrink: 0;
    background: var(--gray-400);
}

.timeline-content {
    flex: 1;
}

.timeline-titulo {
    font-size: 0.9rem;
    display: block;
}

.timeline-fecha {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-lg {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.badge-sm {
    padding: 2px 8px;
    font-size: 0.7rem;
}

.badge-primary { background: var(--primary); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-info { background: var(--info); color: white; }
.badge-secondary { background: var(--gray-400); color: white; }

.badge-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

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

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

.btn-outline { background: white; border: 1px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--gray-400); }

.btn-whatsapp { background: #25d366; color: white; }
.btn-whatsapp:hover { background: #1da851; }

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.input-icon .form-control {
    padding-left: 40px;
}

/* ========== ALERTS ========== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ========== ALERTAS SECTION ========== */
.alertas-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.alerta-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 10px;
    border-left: 4px solid;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.alerta-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.alerta-firma { border-color: var(--warning); }
.alerta-oferta { border-color: var(--success); }

.alerta-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.alerta-firma .alerta-icon { background: #fef3c7; color: var(--warning); }
.alerta-oferta .alerta-icon { background: #d1fae5; color: var(--success); }

.alerta-content {
    flex: 1;
}

.alerta-content strong {
    display: block;
    font-size: 0.95rem;
}

.alerta-content span {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.alerta-action {
    color: var(--gray-400);
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
}

/* ========== TABLES ========== */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}

.doc-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: white;
    padding: 32px;
    text-align: center;
}

.login-header i {
    font-size: 40px;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.login-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.login-form {
    padding: 32px;
}

.login-footer {
    padding: 0 32px 32px;
    text-align: center;
}

.login-footer p {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.login-brand {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ========== DOCUMENTOS GRID ========== */
.documentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.documento-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
}

.documento-pendiente {
    border-color: var(--warning);
}

.documento-card-header {
    padding: 16px;
    background: var(--gray-50);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.documento-card-header i {
    font-size: 1.5rem;
    color: #ef4444;
}

.documento-card-body {
    padding: 16px;
}

.documento-card-body h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.documento-operacion {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.documento-fecha,
.documento-vence {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.documento-card-footer {
    padding: 16px;
    background: var(--gray-50);
}

/* ========== SECTION HEADER ========== */
.section-header {
    margin: 32px 0 16px;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-700);
}

.section-header h2 i {
    color: var(--gray-400);
}

/* ========== UTILITIES ========== */
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-sm { font-size: 0.85rem; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .operacion-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .portal-header {
        padding: 0 16px;
    }
    
    .header-nav {
        display: none;
    }
    
    .portal-main {
        padding: 16px;
    }
    
    .operaciones-grid {
        grid-template-columns: 1fr;
    }
    
    .operacion-detail-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
}
