/* Estilos base y reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body { 
    font-family: 'Roboto', Arial, sans-serif; 
    margin: 0;
    padding: 20px;
    background-color: #f0f3f7; /* Fondo más claro para mejor contraste */
    color: #333;
    line-height: 1.6;
}

.container { 
    max-width: 1200px; 
    margin: 0 auto;
    background: white;
    border-radius: 12px; /* Bordes más redondeados */
    box-shadow: 0 4px 20px rgba(0,0,0,0.12); /* Sombra más pronunciada */
    padding: 32px; /* Mayor padding para aireación */
}

.app-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px; /* Más espacio debajo del encabezado */
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0; /* Borde más grueso */
}

.app-title {
    font-size: 28px; /* Título más grande */
    font-weight: 500;
    color: #1565C0; /* Azul más oscuro para mejor legibilidad */
    display: flex;
    align-items: center;
}

.app-title .material-icons {
    margin-right: 16px;
    font-size: 32px; /* Icono más grande */
}

/* Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px; /* Mayor separación entre secciones */
}

.form-section {
    margin-bottom: 40px; /* Mayor separación vertical */
    padding: 24px; /* Mayor padding interno */
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid #e6e9ef; /* Borde ligero para definir límites */
}

.section-title {
    display: flex;
    align-items: center;
    font-size: 20px; /* Título más grande */
    font-weight: 600; /* Más negrita para mejor visibilidad */
    margin-bottom: 20px;
    color: #1565C0; /* Azul más oscuro para mejor legibilidad */
    border-bottom: 2px solid #e6e9ef; /* Subrayado para destacar secciones */
    padding-bottom: 10px;
}

.section-title .material-icons {
    margin-right: 10px;
    font-size: 24px;
}

.form-group { 
    margin-bottom: 24px; /* Más espacio entre grupos de formulario */
    position: relative; /* Para posicionamiento de elementos hijos */
    padding: 0 0 5px 0; /* Padding inferior para separar del siguiente elemento */
}

label { 
    display: block; 
    margin-bottom: 10px; /* Más espacio entre etiqueta y campo */
    font-weight: 600; /* Negritas para mejorar legibilidad */
    color: #333; /* Color más oscuro para etiquetas */
    font-size: 15px; /* Tamaño de texto más grande */
}

input[type="text"], 
input[type="email"],
input[type="number"], 
textarea, 
select { 
    width: 100%; 
    padding: 14px 16px; /* Input más alto */
    border: 2px solid #ddd; /* Borde más grueso */
    border-radius: 6px; /* Esquinas más redondeadas */
    font-family: 'Roboto', sans-serif;
    font-size: 15px; /* Texto más grande */
    transition: border 0.3s, box-shadow 0.3s;
    background-color: #f9fafc; /* Fondo ligeramente coloreado para visualizar mejor el campo */
}

input:focus, 
textarea:focus, 
select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.25); /* Glow effect más visible */
    background-color: #ffffff; /* Fondo blanco al enfocar */
}

/* Destacar campos activos/hover */
input:hover, 
textarea:hover, 
select:hover {
    border-color: #bbdefb;
}

.phone-group { 
    display: flex; 
    flex-wrap: wrap;
    gap: 12px; /* Mayor separación entre elementos */
    margin-bottom: 8px; 
    align-items: center; 
    background-color: #f9fafc;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e6e9ef;
}

.phone-group select { 
    width: auto; 
    min-width: 140px; /* Más ancho para mejor legibilidad */
    flex-shrink: 0;
    height: 45px; /* Altura fija para mejor alineación */
}

.phone-group input { 
    flex: 1; 
    min-width: 80px;
    height: 45px; /* Altura fija para mejor alineación */
}

.phone-group input.codigo-area, 
.phone-group input.interno { 
    max-width: 110px; /* Campos más anchos */
    flex: 0 0 90px; 
}

.phone-group input.codigo-pais { 
    max-width: 90px; /* Campo más ancho */
    flex: 0 0 80px;
    display: none;
}

.contact-label { 
    width: 130px; /* Más ancho para las etiquetas */
    margin-right: 12px;
    flex-shrink: 0;
}

.phone-hint { 
    color: #546e7a; /* Color más visible */
    font-weight: 500; /* Más negrita */
    font-size: 12px; 
    margin-left: 5px; 
    background-color: #e8f1fb; /* Fondo para destacar */
    padding: 2px 6px;
    border-radius: 3px;
}

small { 
    display: block; 
    margin-top: 8px; 
    color: #546e7a; 
    font-size: 13px; /* Texto más grande */
    font-weight: 500; /* Más legible */
}

.optional { 
    color: #607d8b; /* Color más oscuro para mejor visibilidad */
    font-weight: normal; 
    font-size: 14px;
    margin-left: 8px;
    background-color: #e8f1fb;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Botones modernos */
.btn {
    border: none;
    border-radius: 6px; /* Botones más redondeados */
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    height: 48px; /* Altura fija para todos los botones */
    min-width: 200px; /* Ancho mínimo para mejor visualización */
}

.btn-primary {
    background-color: #1565c0; /* Azul más oscuro */
    color: white;
    padding: 14px 28px; /* Botones más grandes */
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(21, 101, 192, 0.3); /* Sombra colorizada */
}

.btn-primary:hover {
    background-color: #0d47a1;
    box-shadow: 0 6px 10px rgba(13, 71, 161, 0.4);
    transform: translateY(-2px); /* Efecto de elevación */
}

.btn-secondary {
    background-color: #0277bd; /* Color diferenciado del primario */
    color: white;
    padding: 14px 28px;
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(2, 119, 189, 0.3);
}

.btn-secondary:hover {
    background-color: #01579b;
    box-shadow: 0 6px 10px rgba(1, 87, 155, 0.4);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #757575; /* Borde más grueso */
    color: #616161; /* Color más oscuro para mejor contraste */
    padding: 12px 26px;
    font-size: 16px;
}

.btn-outline:hover {
    background-color: #f5f5f5;
    border-color: #424242;
    color: #212121;
}

.add-more-btn { 
    background-color: #4caf50; 
    color: white; 
    padding: 10px 16px;
    border: none; 
    border-radius: 6px; 
    cursor: pointer;
    margin-top: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.add-more-btn:hover { 
    background-color: #388e3c; 
    box-shadow: 0 4px 12px rgba(56, 142, 60, 0.4);
    transform: translateY(-2px);
}

.add-more-btn .material-icons {
    font-size: 20px;
    margin-right: 6px;
}

.btn-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
    padding: 16px;
    background-color: #f5f5f5;
    border-radius: 8px;
    justify-content: center; /* Centrar botones */
}

/* Secciones de contacto */
.contact-section { 
    border-bottom: 1px solid #e0e0e0; 
    padding-bottom: 28px; 
    margin-bottom: 28px; 
}

.contact-group { 
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 8px;
    transition: background-color 0.2s;
    border: 1px dashed #e0e0e0; /* Borde punteado para indicar grupo */
}

.contact-group:hover {
    background-color: #f5f8ff; /* Color más azulado para hover */
    border: 1px dashed #bbdefb;
}

/* Estilo para URL de redes sociales */
.url-prefix {
    min-width: 180px;
    width: 180px;
    display: inline-block;
    padding: 12px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    background-color: #e3f2fd; /* Fondo más visible */
    border-radius: 6px 0 0 6px;
    border: 2px solid #bbdefb;
    border-right: none;
    color: #0277bd; /* Texto más oscuro */
    font-size: 14px;
    font-weight: 500;
}

.social-input {
    flex: 1;
    min-width: 0;
    border-radius: 0 6px 6px 0 !important;
    border-left: none;
}

.social-group {
    display: flex;
    margin-bottom: 16px;
    align-items: center;
    width: 100%;
}

/* Vista previa y código */
#preview { 
    margin-top: 40px; 
    border: 2px solid #e0e0e0; 
    padding: 30px;
    border-radius: 12px;
    background-color: #fff;
    transition: box-shadow 0.3s;
}

#preview:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

#htmlCode { 
    width: 100%; 
    height: 220px; 
    margin-top: 24px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fafafa;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.leyenda-ecologica { 
    color: #43a047; 
    font-style: italic; 
    font-size: 0.9em; 
}

.preview-title {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    color: #1565c0;
    font-weight: 600;
}

/* Destacar campos obligatorios */
.form-group.required label:after {
    content: " *";
    color: #f44336;
}

/* Indicador visual para campos completados */
input:valid:not(:placeholder-shown) {
    border-color: #8bc34a;
    background-color: #f1f8e9;
}

/* Media queries */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-actions button {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .phone-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .phone-group select,
    .phone-group input,
    .contact-label {
        width: 100%;
        max-width: 100%;
    }
    
    .url-prefix {
        width: 120px;
        min-width: 120px;
        font-size: 12px;
        padding: 12px 4px;
    }

    .container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 16px;
        border-radius: 8px;
    }
    
    .form-section {
        padding: 16px;
    }

    .app-title {
        font-size: 22px;
    }
    
    .app-title .material-icons {
        font-size: 24px;
    }
}

/* Estilos adicionales para mejorar el uso del espacio */
@media screen and (min-width: 1024px) {
    .form-grid {
        display: flex;
        flex-direction: column;
        gap: 24px;
        width: 100%;
    }
    
    /* Contenedores para las filas de secciones */
    .top-sections, .bottom-sections {
        display: flex;
        flex-direction: row;
        gap: 24px;
        width: 100%;
    }
    
    .form-section {
        min-width: 300px;
        margin-bottom: 0;
        flex: 1;
        transition: transform 0.3s, box-shadow 0.3s;
    }
    
    /* Efecto hover para secciones */
    .form-section:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    }
    
    .info-section, .phones-section, .emails-section, .socials-section {
        flex: 1;
        max-width: calc(50% - 12px);
    }
    
    .container {
        padding: 32px 48px;
    }
    
    .social-group {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .social-group input {
        margin-top: 5px;
        width: 100%;
    }
    
    .url-prefix {
        margin-bottom: 5px;
        color: #01579b;
        font-weight: 600;
    }

    .full-width {
        width: 100%;
        padding: 12px;
        box-sizing: border-box;
    }
    
    .email-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
        background-color: #f9fafc;
        padding: 16px;
        border-radius: 8px;
        border: 1px solid #e6e9ef;
    }
    
    .email-label-field, .email-input-field {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    
    .email-label-field label, .email-input-field label {
        font-size: 13px;
        color: #555;
        margin-bottom: 4px;
        font-weight: 600;
    }
    
    .email-input-field input {
        width: 100%;
    }
    
    .phone-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    /* Ajustes para la primera fila de campos de teléfono */
    .phone-group-row {
        display: flex;
        gap: 12px;
        align-items: center;
        position: relative;
        justify-content: space-between; /* Distribuir espacio equitativamente */
    }
    
    /* Primera fila de campos */
    .phone-group-row:first-child .contact-label {
        width: 30%;
        min-width: 110px;
        flex: 0 0 auto; /* Tamaño fijo, sin crecer ni encoger */
        background-color: #f0f7ff; /* Fondo para destacar */
    }
    
    .phone-group-row:first-child select {
        width: 40%;
        min-width: 140px;
        flex: 1 1 auto; /* Puede crecer y encogerse para adaptarse */
    }
    
    .phone-group-row:first-child .codigo-pais {
        width: 20%;
        min-width: 70px;
        flex: 0 0 auto; /* Tamaño fijo, sin crecer ni encoger */
        margin-left: auto; /* Empuja el elemento hacia la derecha */
    }
    
    /* Segunda fila de campos */
    .phone-group-row:nth-child(2) {
        justify-content: space-between;
        background-color: #f3f8ff; /* Fondo para diferenciar filas */
        padding: 10px;
        border-radius: 6px;
    }
    
    .phone-group-row:nth-child(2) .phone-hint {
        display: inline-block;
        width: auto;
        margin-right: 5px;
        color: #01579b;
        font-size: 12px;
        flex: 0 0 auto;
    }
    
    .phone-group-row:nth-child(2) .codigo-area {
        width: 25%;
        min-width: 90px;
        flex: 0 0 auto; /* Tamaño fijo a la izquierda */
    }
    
    .phone-group-row:nth-child(2) .numero {
        width: 50%;
        min-width: 150px;
        flex: 1 1 auto; /* Puede crecer en el centro */
    }
    
    .phone-group-row:nth-child(2) .interno {
        width: 15%;
        min-width: 70px;
        flex: 0 0 auto; /* Tamaño fijo a la derecha */
        margin-left: auto;
    }
    
    /* Asegurar que todos los inputs tengan el mismo padding y altura */
    .phone-group-row input, .phone-group-row select {
        height: 45px;
        padding: 0 14px;
        box-sizing: border-box;
    }
    
    /* Eliminar flex de los campos que deben tener tamaño fijo */
    .contact-label, .codigo-area, .codigo-pais, .interno {
        flex: none; /* Anula el comportamiento flexible */
    }

    /* Destacar campo activo */
    .form-section:focus-within {
        box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
    }
}

/* Estilos para dispositivos móviles */
@media screen and (max-width: 1023px) {
    .phone-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .phone-group-row {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .phone-group-row > * {
        flex: 1 1 45%;
        min-width: 120px;
    }
    
    .contact-label, .codigo-area, .numero, .interno {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ajustes para cajas de selección en móviles */
    select {
        padding: 12px;
        height: 48px; /* Más alto para facilitar toque */
    }
    
    .codigo-pais {
        width: 90px;
    }
    
    .phone-hint {
        display: block;
        width: 100%;
        color: #01579b;
        font-size: 12px;
        margin: 4px 0;
        padding: 4px 8px;
        background-color: #e3f2fd;
        border-radius: 4px;
        text-align: center;
    }

    /* Botones más grandes en móvil */
    .btn, .add-more-btn {
        height: 52px;
    }

    /* Mejorar espaciado de secciones en móvil */
    .form-section {
        margin-bottom: 24px;
    }
}

/* Estilos para el selector de logos */
.logos-disponibles {
    margin-top: 8px;
}

.logo-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 10px;
}

.logo-select, .logo-upload {
    flex: 1;
    min-width: 200px;
}

.logo-select select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
}

.logo-upload input[type="file"] {
    width: 100%;
    margin-top: 5px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

#logo-preview-container {
    margin-top: 10px;
}

.logo-preview {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.logo-preview img {
    max-width: 150px;
    max-height: 80px;
    object-fit: contain;
}

.logo-preview p {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #666;
}

.mt-1 {
    margin-top: 8px;
    display: block;
    font-size: 0.9rem;
    color: #555;
}
