/* Reseteo básico y fuente */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600; /* Textos normales en Semibold */
}

/* Fondo azul y centrado absoluto */
body {
    background-color: #004fa5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Tarjeta flotante blanca (Mobile first: 80%) */
.login-card {
    background-color: #ffffff;
    width: 80%;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* Logo */
.logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 20px;
}

/* Título */
.login-card h2 {
    color: #333333;
    font-size: 24px;
    margin-bottom: 25px;
    font-weight: 800; /* Título pesado */
}

/* Estilos de los inputs y labels */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #004fa5;
}

/* Botón de envío */
.btn-submit {
    width: 100%;
    padding: 14px;
    background-color: #004fa5;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.btn-submit:hover {
    background-color: #003a7a;
}

/* Mensaje de error de PHP */
.error-msg {
    color: #d93025;
    background-color: #fce8e6;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Media Query para Escritorio (50%) */
@media (min-width: 768px) {
    .login-card {
        width: 50%;
        max-width: 500px; /* Un tope máximo opcional para pantallas gigantes */
    }
}

/* =========================================
   PANEL DE CLIENTE
========================================= */

/* Layout general del panel */
body.client-layout {
    background-color: #f2f2f2;
    padding: 40px 5%;
    color: #333333;
    min-height: 100vh;
    display: block; /* Sobrescribe el flex del login si están en la misma hoja */
}

/* Encabezado */
.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.client-header h1 {
    font-size: 35px;
    margin-bottom: 5px;
    font-weight:800;
}

.client-header p {
    color: #666666;
    font-size: 15px;
}

/* Línea divisoria */
.divider {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 20px 0 30px 0;
}

/* Título de sección */
.client-layout h2 {
    font-size: 22px;
    margin-bottom: 20px;
    font-weight: 800;
    
}

/* Grilla de proyectos (Responsive automático) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Tarjeta de proyecto */
.project-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.project-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.text-muted {
    color: #777777;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Barra de progreso */
.progress-container {
    background-color: #e9ecef;
    border-radius: 8px;
    width: 100%;
    height: 20px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    background-color: #28a745; /* Verde para éxito/progreso */
    height: 100%;
    border-radius: 8px;
    transition: width 0.4s ease;
}

.client-layout .progress-text {
    font-size: 13px;
    text-align: right;
    color: #555555;
    margin-bottom: 20px;
}

.client-form-layout .progress-text {
    font-size: 13px;
    text-align: left;
    color: #555555;
    Margin-top: 30px;
    margin-bottom: 10px;
}

/* =========================================
   SISTEMA DE BOTONES (Enlaces con aspecto de botón)
========================================= */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.1s ease;
    cursor: pointer;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #0062cc; /* Tu azul principal */
    color: #ffffff;
    width: 100%;
    padding: 14px;
    margin-top: 10px; /* Empuja el botón al fondo de la tarjeta */
}

.btn-primary:hover {
    background-color: #003c7b;
}

.btn-secondary {
    background-color: #ffffff;
    color: #003a7a;
}

.btn-secondary:hover {
    background-color: #004fa5;
    color: #fff;
}

.btn-danger {
    background-color: #ffffff;
    color:#003a7a;
}

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

/* =========================================
   VISTA DE FORMULARIO DE PROYECTO
========================================= */

.client-form-layout {
    background-color: #f2f2f2;
    padding: 30px 5%;
    color: #333333;
    display: block; /* Evita heredar flex del login */
}

/* Cabecera Flotante */
.client-form-layout .sticky-header {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    top: 20px;
    z-index: 100;
}

.client-form-layout .sticky-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

/* Enlace volver */
.btn-back {
    text-decoration: none;
    color: #555555;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.3s;
}

.btn-back:hover {
    color: #004fa5;
}

/* Navegación de Pestañas */
.tabs-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 20px;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #555555;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    border-color: #004fa5;
    color: #004fa5;
}

.tab-btn.active {
    background: #e9ecef;
    border-color: #caced1;
    color: #333333;
}

/* Contenido de Pestañas */
.tab-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.tab-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.tab-header-flex h3 {
    margin: 0;
    font-size: 20px;
    color: #333333;
    font-weight: 800;
}

.link_fotos{
    margin-bottom: 20px;
    background-color: #f2f2f2;
    border-radius: 8px;
    padding: 15px;
}

/* Indicadores de Progreso */
.progress-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #333;
    margin-left: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-circle span {
    background: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Campos del Formulario */
.field-wrapper {
    margin-bottom: 20px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: border-left-color 0.3s ease;
}

.field-wrapper label {
    display: block;
    margin-bottom: 10px;
    color: #333333;
}

.status-pendiente { border-left: 5px solid #ffc107; }
.status-enviado { border-left: 5px solid #28a745; opacity: 0.9; }

.saved-feedback {
    color: #28a745;
    font-size: 12px;
    display: none;
    margin-left: 10px;
    font-weight: 600;
}

/* Inputs y Textareas */
.auto-save-input,
.client-form-layout input[type="url"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.auto-save-input:focus,
.client-form-layout input[type="url"]:focus {
    outline: none;
    border-color: #004fa5;
}

textarea.auto-save-input {
    min-height: 120px; /* Una buena altura inicial que invita a escribir bastante */
    field-sizing: content; /* La magia para que crezca automáticamente */
    resize: none; /* Quitamos la flechita manual porque ahora es automático */
    overflow-y: hidden; /* Evitamos que salga la barra de scroll vertical */
}

/* Galería de imágenes */
.gallery-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Tabla de Ecommerce */
.table-responsive {
    overflow-x: auto;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.client-form-layout table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
    text-align: left;
}

.client-form-layout th {
    background-color: #f8f9fa;
    padding: 15px;
    color: #333333;
    font-size: 14px;
    border-bottom: 2px solid #e0e0e0;
}

.client-form-layout td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.ecommerce-input {
    /* Ajuste automático de ancho */
    field-sizing: content; 
    min-width: 120px; /* Un tamaño base para que los campos vacíos se vean bien */
    max-width: 400px; /* Un tope opcional para que una columna no se vuelva gigante */
    
    /* Estilos base que ya tenías */
    border: 1px solid transparent;
    padding: 10px;
    border-radius: 6px;
    background: transparent;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
}

.ecommerce-input:focus,
.ecommerce-input:hover {
    border-color: #cccccc;
    background: #ffffff;
    outline: none;
}

/* =========================================
   TABLA ECOMMERCE (Scroll y Ajuste Automático)
========================================= */

/* Contenedor con scroll horizontal exclusivo */
#tab-ecommerce .table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Tabla: Que crezca lo necesario hacia los lados */
.ecommerce-table {
    width: max-content; /* Permite que la tabla se expanda sin cortarse */
    min-width: 100%;
    border-collapse: collapse;
}

/* Columnas y Filas: Ajuste al contenido con líneas divisorias */
.ecommerce-table th,
.ecommerce-table td {
    white-space: nowrap; 
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0; /* Línea horizontal (que ya tenías) */
    border-right: 1px solid #f0f0f0;  /* ¡NUEVA! Línea vertical divisoria */
    vertical-align: top; 
}

/* Limpieza visual: quitamos la línea vertical de la última columna */
.ecommerce-table th:last-child,
.ecommerce-table td:last-child {
    border-right: none;
}

/* Excepción: Celda de Descripción (permite salto de línea) */
.ecommerce-table td.col-multiline {
    white-space: normal; 
}

/* Textarea de Descripción Corta */
.textarea-expandable {
    width: 280px; /* Ancho fijo para esta columna */
    min-height: 42px; /* Alto inicial (1 línea aprox) */
    max-height: 210px; /* Alto máximo (5 líneas aprox) */
    field-sizing: content; /* Magia moderna: crece automáticamente con el texto */
    resize: none; /* Desactiva la flechita manual de estirar */
    overflow-y: auto; /* Muestra scroll interno si pasa las 5 líneas */
    
    /* Estilos base para que luzca como los demás inputs */
    border: 1px solid #cccccc;
    border-radius: 6px;
    padding: 10px;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.textarea-expandable:focus,
.textarea-expandable:hover{
    border-color: #cccccc;
    background: #ffffff;
    outline: none;
}

/* =========================================
   PÁGINA DE PERFIL (Estilo Tarjeta)
========================================= */

/* Tarjeta flotante blanca (Hereda la lógica del Login) */
.profile-card {
    background-color: #ffffff;
    width: 80%;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

@media (min-width: 768px) {
    .profile-card {
        width: 50%;
        max-width: 500px;
    }
}

/* Título de la tarjeta */
.profile-card h2 {
    color: #333333;
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: 800;
}

/* Botón de volver */
.btn-back-profile {
    display: inline-block;
    text-decoration: none;
    color: #004fa5;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 25px;
    transition: color 0.3s ease;
}

.btn-back-profile:hover {
    color: #003a7a;
}

/* Mensaje de sistema (verde por defecto para éxito) */
.alert-msg:not(:empty) {
    background-color: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Aseguramos que el input de tipo texto tenga el mismo estilo que email y password */
input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    font-family: inherit;
    font-weight: 600;
}

input[type="text"]:focus {
    outline: none;
    border-color: #004fa5;
}
