:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --accent-color: #e74c3c;
    --light-gray: #f5f5f5;
    --dark-gray: #333;
    --medium-gray: #777;
    --border-radius: 4px;
    --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: #f9f9f9;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: var(--box-shadow);
}

main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1, h2, h3 {
    margin-bottom: 1rem;
}

.app-container {
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

.controls-panel {
    flex: 1;
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.control-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.logo-controls, .text-controls, .download-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="file"] {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    resize: vertical;
    font-family: inherit;
}

.size-controls, .font-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.size-controls label, .font-controls label {
    flex: 0 0 125px;
}

input[type="range"] {
    flex: 1;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.seal-button, .download-button, .storage-button {
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 1rem;
    align-self: flex-start;
}

.seal-button {
    background-color: var(--primary-color);
}
.seal-button:hover {
    background-color: var(--secondary-color);
}
.download-button {
    background-color: #196F3D;
}
.download-button:hover {
    background-color: #145A32;
}
.storage-button {
    background-color: #8e44ad;
}
.storage-button:hover {
    background-color: #703688;
}

input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    cursor: pointer;
    padding: 2px;
}

.preview-container {
    flex: 1.5;
}

.paper-preview {
    background-color: white;
    box-shadow: var(--box-shadow);
    padding: 2rem 3rem; /* ← Márgenes izquierdo y derecho aumentados */
    min-height: 800px;
    position: relative;
    border: 1px solid #ddd;
    overflow: hidden;
    z-index: 0;
}

.paper-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: white;
    z-index: -1;
}

.preview-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid #ccc; /* Línea más suave */
    padding-bottom: 1rem;
    background-color: var(--light-gray);
    position: relative;
    z-index: 1;
}

#preview-logo {
    max-width: 200px;
    height: auto;
    margin-right: 1rem;
}

.preview-header-text {
    font-size: 18px;
    font-weight: bold;
}

.preview-body-text {
    font-size: 14px;
    min-height: 400px;
    white-space: pre-wrap;
    text-align: justify;
    padding: 0 1.5rem;
    background-color: white;
    position: relative;
    z-index: 1;
}

.preview-footer-text {
    font-size: 12px;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 3px solid #bbb; /* Línea inferior más gruesa */
    position: absolute;
    bottom: 2rem;
    left: 3rem;
    right: 3rem;
    background-color: var(--light-gray);
    font-weight: bold;
    z-index: 1;
}

.preview-seal {
    position: absolute;
    z-index: 1;
    cursor: move;
    max-width: 150px;
    max-height: 150px;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
}

.preview-seal img {
    max-width: 100%;
    max-height: 100%;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #3498db;
    border: 1px solid white;
    border-radius: 50%;
    right: -5px;
    bottom: -5px;
    cursor: se-resize;
}

.text-input-container {
    position: relative;
    width: 100%;
}

.bold-button {
    display: none;
}

.text-editor-toolbar {
    display: flex;
    gap: 0.5rem;
    background-color: var(--light-gray);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.editor-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.editor-btn:hover {
    background: #e5e5e5;
}

.separator {
    color: #ddd;
    align-self: center;
}

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }

    .controls-panel, .preview-container {
        width: 100%;
    }

    .paper-preview {
        min-height: 600px;
    }
}

@media (max-width: 600px) {
    .radio-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .size-controls, .font-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .size-controls input, .font-controls input {
        width: 100%;
    }
}
