/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #004D35;
    --secondary-color: #006B4F;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --text-dark: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header de la aplicación - Diseño minimalista */
.app-header {
    background: var(--bg-white);
    padding: 20px 30px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #004D35;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 45px;
    width: auto;
    object-fit: contain;
}

.app-header h1 {
    color: #004D35;
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.5px;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-logo {
        height: 40px;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }
}

/* Layout principal */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Secciones - Diseño minimalista */
.form-section,
.preview-section {
    background: var(--bg-white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.form-section h2,
.preview-section h2 {
    color: #004D35;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 2px solid #004D35;
    padding-bottom: 8px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Color picker */
.color-picker-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker-group input[type="color"] {
    width: 60px;
    height: 45px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

.color-picker-group input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: monospace;
}

/* Botones */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background: #004D35;
    color: white;
}

.btn-primary:hover {
    background: #003d2a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: #004D35;
    border: 2px solid #004D35;
}

.btn-secondary:hover {
    background: #f5f7fa;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
    flex: none;
}

/* Preview section */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-actions {
    display: flex;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Preview iframe */
.email-preview {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

#previewFrame {
    width: 100%;
    min-height: 600px;
    border: none;
    background: white;
}

/* Code preview */
#htmlCode {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

#htmlCode code {
    color: #e2e8f0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: var(--success-color);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    font-weight: 600;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.notification.error {
    background: var(--danger-color);
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Image preview */
.image-preview {
    position: relative;
    margin-top: 15px;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.remove-image-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.remove-image-btn:hover {
    background: #c53030;
    transform: scale(1.05);
}

/* File input styling */
input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

input[type="file"]:hover {
    border-color: var(--primary-color);
    background: white;
}

input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Required and optional badges */
.required {
    color: var(--danger-color);
    font-weight: bold;
}

.optional-badge {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 5px;
}

/* Form section headers */
.form-section-header {
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.form-section-header h3 {
    color: var(--text-dark);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.form-section-header small {
    color: var(--text-light);
    font-size: 0.85rem;
}

.form-section-header.optional-section {
    border-bottom-color: var(--secondary-color);
    border-bottom-style: dashed;
}

/* Info box */
.info-box {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
}

.info-box h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.info-box p {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 10px;
}

.info-box li {
    padding: 5px 0;
    color: var(--text-dark);
    position: relative;
    padding-left: 25px;
}

.info-box li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.info-box small {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Quill WYSIWYG Editor */
.wysiwyg-editor {
    min-height: 150px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.wysiwyg-editor:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Estilos para la toolbar de Quill */
.ql-toolbar {
    background: var(--bg-light);
    border: none !important;
    border-bottom: 2px solid var(--border-color) !important;
    border-radius: 8px 8px 0 0;
    padding: 12px !important;
}

.ql-container {
    border: none !important;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
}

.ql-editor {
    min-height: 120px;
    padding: 15px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #666666;
}

.ql-editor.ql-blank::before {
    color: var(--text-light);
    font-style: italic;
}

/* Estilos para los botones de la toolbar */
.ql-toolbar button {
    transition: all 0.2s ease;
}

.ql-toolbar button:hover {
    color: var(--primary-color);
}

.ql-toolbar button.ql-active {
    color: var(--primary-color);
}

.ql-stroke {
    stroke: var(--text-dark);
}

.ql-toolbar button:hover .ql-stroke {
    stroke: var(--primary-color);
}

.ql-fill {
    fill: var(--text-dark);
}

.ql-toolbar button:hover .ql-fill {
    fill: var(--primary-color);
}

.ql-picker-label {
    color: var(--text-dark);
}

.ql-picker-label:hover {
    color: var(--primary-color);
}

/* Tooltips de Quill */
.ql-tooltip {
    z-index: 100;
}
