/* Estilos generales */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    transition: background-color 0.5s ease;
    background-color: #f0f2f5; /* Color de fondo por defecto */
}

/* Contenedor principal */
#app-container {
    max-width: 680px;
    margin: 40px auto;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

/* Logo o imagen del negocio */
.logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Public footer CTA */
.public-footer a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

/* CTA box at the end of public page: subtle, centered, doesn't overpower main content */
.public-cta {
    margin-top: 20px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    backdrop-filter: blur(3px);
    border: 1px solid rgba(0,0,0,0.06);
}
.public-cta p { margin: 0; }

/* Icons next to links */
.link-button .fa-fw { margin-right: 10px; }
.link-icon-select { width: 160px; padding: 8px; border-radius:6px; margin-top:8px; }
.link-editor-row select { padding:8px; border-radius:6px; border:1px solid #ccc; }

/* Make color pickers compact and align side-by-side via .form-row */
.form-row { display:flex; gap:8px; }
#color_fondo, #color_letra { width:48px; height:34px; padding:4px; border-radius:6px; }

/* Título de la página */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 30px 0;
}

/* Contenedor de los links */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Estilo de cada botón/link */
.link-button {
    display: block;
    padding: 18px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
    color: #1a1a1a;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.link-button:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* --- Estilos para la Vista de Edición --- */
.editor-form {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.editor-fields { 
    width: 100%;
}

.editor-sidebar {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor-preview {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.editor-preview .logo { width: 72px; height:72px; }
.editor-preview .page-title { font-size: 1.1rem; margin-top:8px; }
.preview-links { display:flex; flex-direction: column; gap:8px; margin-top:12px; }
.preview-link { display:flex; align-items:center; gap:10px; padding:10px; border-radius:8px; background:#f8f9fb; border:1px solid #eee; text-decoration:none; color:inherit; }
.preview-link i { width:20px; text-align:center; }

/* QR Section */
.qr-section {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.qr-title {
    margin: 0 0 12px 0;
    font-weight: 500;
    font-size: 1rem;
    color: #333;
}

.qr-image {
    width: 150px;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: block;
    margin: 0 auto 12px;
}

.qr-download-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.qr-download-btn:hover {
    background: #0056b3;
}

/* Improved link-editor card */
.link-editor-card { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    padding: 10px; 
    background: #fafafa; 
    border: 1px solid #eee; 
    border-radius: 8px; 
    margin-bottom: 12px;
}

.link-editor-row { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
    flex-wrap: wrap;
}

.link-editor-row input[type=text] { 
    flex: 1; 
    min-width: 200px;
}

.link-editor-row select {
    min-width: 120px;
}

.link-editor-actions { 
    display: flex; 
    gap: 8px; 
    flex-wrap: wrap;
}

.link-editor-actions button {
    padding: 8px 12px;
    font-size: 13px;
}

.editor-form h1 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn-save {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background-color: #007bff;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-save:hover {
    background-color: #0056b3;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #app-container { 
        margin: 10px; 
        padding: 10px; 
    }
    
    .editor-form { 
        padding: 15px; 
    }
    
    .logo { 
        width: 80px; 
        height: 80px; 
    }
    
    .page-title { 
        font-size: 1.25rem; 
    }
    
    .link-button { 
        padding: 14px 16px; 
        font-size: 0.95rem; 
    }
    
    .editor-form input[type=text], 
    .editor-form input[type=color], 
    .editor-form input[type=file],
    .editor-form textarea { 
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .links-list { 
        gap: 12px; 
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    .editor-form h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .qr-section {
        padding: 15px;
    }
    
    .qr-image {
        width: 120px;
        height: 120px;
    }
    
    /* Stack form rows on mobile */
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-row .form-group {
        margin-right: 0 !important;
    }
    
    /* Link editor cards responsive */
    .link-editor-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .link-editor-row input[type=text] {
        min-width: 100%;
    }
    
    .link-editor-row select {
        width: 100%;
    }
    
    .link-editor-actions {
        justify-content: space-between;
    }
    
    .link-editor-actions button {
        flex: 1;
        min-width: auto;
    }
    
    /* Better button spacing on mobile */
    .btn-save {
        padding: 16px;
        font-size: 1.05rem;
    }
    
    #add-link-btn {
        width: 100%;
        text-align: center;
    }
}

@media (min-width: 769px) {
    /* Desktop/editor: two column layout */
    #app-container { 
        max-width: 1200px; 
    }
    
    .editor-form { 
        max-width: 1200px; 
        margin: 0 auto; 
    }
    
    .editor-grid {
        grid-template-columns: 1fr 380px;
    }
    
    .editor-sidebar {
        position: sticky;
        top: 20px;
        align-self: flex-start;
    }
}

@media (min-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr 420px;
    }
}

/* Rueda de carga (Loader) */
.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 100px auto;
}

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