* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

/* BOTONES INFERIORES */
.bottom-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

/* CABECERA */
.cabecera {
    background: white;
    padding: 14px 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cabecera-logo {
    height: 45px;
    width: auto;
    flex-shrink: 0;
}

.cabecera-text {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex-wrap: wrap;
}

.cabecera h1 {
    font-size: 2.4em;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.subtitulo {
    text-align: left;
    color: #6b7280;
    font-size: 0.9em;
    margin: -10px 0 15px 24px;
    font-weight: 500;
}

/* LAYOUT PRINCIPAL */
.main-layout {
    display: grid;
    grid-template-columns: 50% 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* CONTENEDOR DE FUENTES */
.contenedor {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.contenedor h2 {
    color: #111;
    margin-bottom: 10px;
    font-weight: 600;
}

.controles {
    position: sticky;
    top: -20px;
    background: white;
    padding: 20px 0 10px;
    margin: -20px 0 15px;
    border-bottom: 1px solid #e5e7eb;
    z-index: 10;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}

.font-load-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-load-fonts {
    padding: 7px 14px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.btn-load-fonts:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-load-fonts.active {
    background: #374151;
    color: white;
    border-color: #374151;
}

.btn-load-fonts.orange {
    border-color: #d1d5db;
    color: #374151;
}

.btn-load-fonts.orange:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-load-fonts.orange.active {
    background: #374151;
    color: white;
    border-color: #374151;
}

.btn-load-fonts.red {
    border-color: #d1d5db;
    color: #374151;
}

.btn-load-fonts.red:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-load-fonts.red.active {
    background: #374151;
    color: white;
    border-color: #374151;
}

.btn-load-fonts:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#font-size-slider {
    width: 150px;
    vertical-align: middle;
}

#size-value {
    display: inline-block;
    min-width: 45px;
    margin-left: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}

#search-fonts {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Inter', system-ui, sans-serif;
    transition: border-color 0.2s;
}

#search-fonts:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 1px #374151;
}

/* GRID DE FUENTES */
.fonts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.font-card {
    background: #fafafa;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

.font-card:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.font-card.selected-principal {
    border-color: #10b981;
    background: #f0fdf4;
}

.font-card.selected-secundaria {
    border-color: #3b82f6;
    background: #eff6ff;
}

.font-name {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.font-sample {
    margin-bottom: 14px;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
}

.font-buttons {
    display: flex;
    gap: 6px;
}

.btn-principal,
.btn-secundaria {
    flex: 1;
    padding: 5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-principal {
    background: #10b981;
    color: white;
}

.btn-principal:hover {
    background: #059669;
}

.btn-principal.active {
    background: #064e3b;
}

.btn-secundaria {
    background: #3b82f6;
    color: white;
}

.btn-secundaria:hover {
    background: #2563eb;
}

.btn-secundaria.active {
    background: #1e40af;
}

/* PREVISUALIZADO */
.previsualizado {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    height: calc(100vh - 100px);
    overflow-y: auto;
}

.previsualizado h2 {
    color: #111;
    margin-bottom: 20px;
    font-weight: 600;
}

.preview-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

#text-selector {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Inter', system-ui, sans-serif;
    cursor: pointer;
}

/* CONTROLES TIPOGRÁFICOS */
.typography-controls {
    background: #f9fafb;
    padding: 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.typography-controls h3 {
    color: #374151;
    margin-bottom: 14px;
    font-size: 0.95em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-item label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-item label span {
    color: #6b7280;
    font-size: 12px;
    background: white;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
    font-weight: 500;
}

.control-item input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #374151;
    cursor: pointer;
    transition: background 0.2s;
}

.control-item input[type="range"]::-webkit-slider-thumb:hover {
    background: #111827;
}

.control-item input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #374151;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.control-item input[type="range"]::-moz-range-thumb:hover {
    background: #111827;
}

.btn-save {
    padding: 9px 18px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-save:hover:not(:disabled) {
    background: #059669;
}

.btn-save:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.preview-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-section {
    background: #fafafa;
    padding: 18px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.preview-section.combined {
    background: #fafafa;
    border: 1px solid #d1d5db;
}

.preview-section label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.preview-principal,
.preview-secundaria,
.preview-combined {
    background: white;
    padding: 20px;
    border-radius: 4px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    border: 1px solid #f0f0f0;
}

.preview-text {
    text-align: left;
    color: #9ca3af;
    font-style: italic;
}

.combined-title {
    font-size: 2em;
    margin-bottom: 15px;
    color: #1f2937;
}

.combined-text {
    font-size: 1.1em;
    line-height: 1.6;
    color: #4b5563;
}

.combined-text p {
    margin-bottom: 16px;
}

#custom-title {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    font-family: inherit;
    display: none;
}

#custom-title.active {
    display: block;
}

#custom-title:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 1px #374151;
}

#custom-text {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 20px;
    font-family: inherit;
    display: none;
}

#custom-text.active {
    display: block;
}

#custom-text:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 1px #374151;
}

/* BOTÓN VER GUARDADAS */
.btn-guardadas {
    padding: 9px 18px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-guardadas:hover {
    background: #1f2937;
}

/* MODAL COMBINACIONES GUARDADAS */
.modal-guardadas {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    overflow-y: auto;
}

.modal-guardadas-content {
    width: 96%;
    max-width: 1400px;
    margin: 30px auto;
    padding: 30px;
    animation: modalSlideIn 0.25s ease-out;
}

.modal-guardadas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.modal-guardadas-header h2 {
    color: #111;
    font-size: 1.6em;
    font-weight: 600;
}

.btn-cerrar-guardadas {
    background: #374151;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-cerrar-guardadas:hover {
    background: #1f2937;
}

/* COMBINACIONES GUARDADAS */
.guardadas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.empty-message {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    grid-column: 1 / -1;
}

.saved-combination {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0;
    position: relative;
    transition: box-shadow 0.2s;
    overflow: hidden;
}

.saved-combination:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.saved-combination-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #f0f0f0;
}

.saved-date {
    font-size: 12px;
    color: #9ca3af;
}

.saved-buttons {
    display: flex;
    gap: 6px;
}

.btn-duplicate {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-duplicate:hover {
    background: #e5e7eb;
}

.btn-delete {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #fee2e2;
}

.saved-preview {
    background: #fafafa;
    padding: 18px;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
}

.saved-title {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #1f2937;
}

.saved-text {
    font-size: 0.95em;
    line-height: 1.5;
    color: #4b5563;
}

.saved-fonts-info {
    font-size: 12px;
    color: #6b7280;
    padding: 12px 18px;
}

.saved-fonts-info span {
    display: block;
    margin-bottom: 3px;
}

.font-link {
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.font-link:hover {
    color: #111827;
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-style: italic;
}

/* BOTÓN DE CRÉDITOS */
.credits-button {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 9px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.credits-button:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* MODAL DE CRÉDITOS */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 36px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #9ca3af;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #374151;
}

.modal-content h2 {
    color: #111;
    margin-bottom: 25px;
    font-size: 1.6em;
    text-align: center;
    font-weight: 700;
}

.credits-text {
    line-height: 1.8;
}

.credits-text h3 {
    color: #374151;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 5px;
}

.credits-text p {
    color: #4b5563;
    margin-bottom: 8px;
}

.credits-text a {
    color: #374151;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
    transition: color 0.2s;
}

.credits-text a:hover {
    color: #111827;
}

/* SCROLLBAR PERSONALIZADO */
.contenedor::-webkit-scrollbar,
.previsualizado::-webkit-scrollbar {
    width: 6px;
}

.contenedor::-webkit-scrollbar-track,
.previsualizado::-webkit-scrollbar-track {
    background: transparent;
}

.contenedor::-webkit-scrollbar-thumb,
.previsualizado::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.contenedor::-webkit-scrollbar-thumb:hover,
.previsualizado::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .contenedor,
    .previsualizado {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .cabecera h1 {
        font-size: 1.8em;
    }
    
    .fonts-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .guardadas-grid {
        grid-template-columns: 1fr;
    }
}
