/* =============================================
   Portal del Cliente - Custom Styles
   Tema Claro / Profesional
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --cl-bg: #f8fafc;
    --cl-white: #ffffff;
    --cl-surface: #ffffff;
    --cl-border: #e2e8f0;
    --cl-border-light: #f1f5f9;
    --cl-primary: #004a99;
    --cl-primary-hover: #003d7a;
    --cl-primary-light: rgba(0, 74, 153, 0.08);
    --cl-accent: #f48220;
    --cl-success: #22c55e;
    --cl-success-light: rgba(34, 197, 94, 0.1);
    --cl-warning: #f59e0b;
    --cl-warning-light: rgba(245, 158, 11, 0.1);
    --cl-danger: #ef4444;
    --cl-danger-light: rgba(239, 68, 68, 0.1);
    --cl-info: #06b6d4;
    --cl-text: #1e293b;
    --cl-text-secondary: #475569;
    --cl-text-muted: #94a3b8;
    --cl-radius: 16px;
    --cl-radius-sm: 10px;
    --cl-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --cl-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --cl-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--cl-bg);
    color: var(--cl-text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--cl-primary);
    transition: var(--cl-transition);
}

a:hover {
    color: var(--cl-primary-hover);
}

/* =============================================
   Navbar — Cliente Portal
   ============================================= */
.cliente-navbar {
    background: var(--cl-white);
    border-bottom: 1px solid var(--cl-border);
    padding: 0 32px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cliente-navbar .nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cliente-navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cliente-navbar .nav-link-item {
    padding: 10px 16px;
    border-radius: var(--cl-radius-sm);
    color: var(--cl-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--cl-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cliente-navbar .nav-link-item:hover {
    background: var(--cl-primary-light);
    color: var(--cl-primary);
}

.cliente-navbar .nav-link-item.active {
    background: var(--cl-primary-light);
    color: var(--cl-primary);
    font-weight: 600;
}

.cliente-navbar .nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cliente-navbar .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--cl-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 74, 153, 0.2);
}

.cliente-navbar .btn-logout {
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cl-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cliente-navbar .btn-logout:hover {
    border-color: var(--cl-danger);
    color: var(--cl-danger);
    background: var(--cl-danger-light);
}

/* =============================================
   Main Content
   ============================================= */
.cliente-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* =============================================
   Cards
   ============================================= */
.cliente-card {
    background: var(--cl-surface);
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    box-shadow: var(--cl-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header-cl {
    padding: 24px;
    border-bottom: 1px solid var(--cl-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-cl h5 {
    margin: 0;
    font-weight: 700;
    color: var(--cl-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body-cl {
    padding: 24px;
}

/* =============================================
   Dashboard Specific
   ============================================= */
.welcome-banner {
    padding: 48px;
    border-radius: 24px;
    color: white;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.welcome-banner h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
}

.welcome-banner p {
    font-size: 18px;
    opacity: 0.9;
}

.stat-card-cl {
    background: white;
    border-radius: 20px;
    padding: 32px;
    border: 1px solid var(--cl-border);
    text-align: center;
    transition: var(--cl-transition);
}

.stat-card-cl:hover {
    transform: translateY(-5px);
    box-shadow: var(--cl-shadow-lg);
}

.stat-icon-cl {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 20px;
}

/* =============================================
   Timeline / Bitácora
   ============================================= */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 0;
    width: 2px;
    background: var(--cl-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -37px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cl-primary);
    border: 2px solid white;
    box-shadow: 0 0 0 4px var(--cl-primary-light);
    z-index: 2;
}

.timeline-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--cl-text-muted);
    margin-bottom: 12px;
}

.timeline-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--cl-border);
    box-shadow: var(--cl-shadow);
}

.timeline-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cl-text);
    margin-bottom: 12px;
}

.timeline-text {
    font-size: 15px;
    color: var(--cl-text-secondary);
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* FIX: Resize images within timeline to 75% and add click effect */
.timeline-text img, 
.timeline-text p img,
.timeline-card img {
    width: 75% !important; /* Slightly larger as requested */
    max-width: 75% !important; 
    height: auto !important;
    border-radius: 12px;
    margin: 25px auto !important; 
    display: block !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    background: #fff;
    border: 1px solid var(--cl-border-light);
    box-sizing: border-box;
    padding: 6px;
    cursor: zoom-in; /* Indicate it's clickable */
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.timeline-text img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* Modal styles for image zoom */
.img-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
    cursor: zoom-out;
}

.img-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform:scale(0.7); opacity:0} 
    to {transform:scale(1); opacity:1}
}

.img-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.img-modal-close:hover {
    color: #bbb;
}

@media (max-width: 768px) {
    .timeline-text img, 
    .timeline-text p img,
    .timeline-card img {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* On mobile screens, use more space for better visibility */
@media (max-width: 768px) {
    .timeline-text img {
        max-width: 95% !important;
    }
}

/* =============================================
   Estilos de Login, Recuperar y Reset
   ============================================= */
.cliente-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    background-color: #f0f4f8;
    z-index: 1;
}

.cliente-login-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top right, rgba(0, 74, 153, 0.08), transparent),
                radial-gradient(circle at bottom left, rgba(244, 130, 32, 0.05), transparent);
    z-index: -1;
}

.cliente-login-card {
    background: var(--cl-white);
    width: 50%; /* Requerimiento del usuario */
    min-width: 320px;
    padding: 60px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--cl-border);
    animation: loginAppearing 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.login-logo img {
    max-width: 320px;
    height: auto;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--cl-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--cl-text-secondary);
    font-size: 16px;
    margin: 0;
}

/* Estilo para los inputs flotantes */
.form-floating > .form-control {
    border: 1px solid var(--cl-border);
    border-radius: 12px;
    padding-left: 15px;
    background-color: #fcfdfe;
    height: 60px;
}

.form-floating > .form-control:focus {
    border-color: var(--cl-primary);
    box-shadow: 0 0 0 4px var(--cl-primary-light);
    background-color: var(--cl-white);
}

.form-floating > label {
    padding-left: 15px;
    color: var(--cl-text-muted);
}

.btn-login {
    width: 100%;
    height: 56px;
    background: var(--cl-primary);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 74, 153, 0.3);
}

.btn-login:hover {
    background: var(--cl-primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -5px rgba(0, 74, 153, 0.4);
    color: white;
}

.login-alert {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.animate-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.login-footer {
    margin-top: 32px;
    text-align: center;
}

.forgot-password {
    color: var(--cl-text-secondary);
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.forgot-password:hover {
    color: var(--cl-primary);
}

/* FIX: Table and general container overflow within timeline */
.timeline-text {
    font-size: 15px;
    color: var(--cl-text-secondary);
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: anywhere; /* Force break long URLs/strings */
    word-break: break-word;
    padding: 10px 0;
    max-width: 100%;
    overflow-x: auto; /* Allow horizontal scroll for extra-wide content like tables */
    scrollbar-width: thin; /* Clean scrollbar for Firefox */
}

/* FIX: Webkit scrollbar styling for better aesthetics */
.timeline-text::-webkit-scrollbar {
    height: 6px;
}
.timeline-text::-webkit-scrollbar-thumb {
    background: var(--cl-border);
    border-radius: 10px;
}

.timeline-text table {
    width: 100% !important;
    max-width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.timeline-evidencias {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--cl-border-light);
}

.timeline-evidencias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.timeline-evidencia-item {
    background: var(--cl-border-light);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--cl-transition);
}

.timeline-evidencia-item:hover {
    background: var(--cl-primary-light);
}

.timeline-ev-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.timeline-ev-info {
    flex: 1;
    min-width: 0;
}

.timeline-ev-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--cl-text);
}

.timeline-admin {
    margin-top: 20px;
    font-size: 12px;
    color: var(--cl-text-muted);
    font-weight: 500;
}

/* =============================================
   Badges
   ============================================= */
.badge-cl {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-cl-activo { background: var(--cl-success-light); color: var(--cl-success); }
.badge-cl-inactivo { background: var(--cl-danger-light); color: var(--cl-danger); }
.badge-cl-suspendido { background: var(--cl-warning-light); color: var(--cl-warning); }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .cliente-navbar {
        padding: 0 16px;
        height: auto;
        min-height: 72px;
        flex-direction: column;
        padding-bottom: 12px;
    }
    
    .cliente-navbar .nav-links {
        margin-top: 12px;
        width: 100%;
        justify-content: center;
    }

    .welcome-banner {
        padding: 32px 24px;
    }
    
    .timeline {
        padding-left: 24px;
    }
    
    .timeline-item::before {
        left: -29px;
    }
}
