/* NewsletterGen App Styles */

:root {
    --primary-blue: #2d415d;
    --light-blue: #eaf6fb;
    --off-white: #fafdfe;
    --gray: #dde0e1;
    --border-gray: #ccc;
    --success-green: #28a745;
    --error-red: #dc3545;
    --warning-yellow: #ffc107;
}

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

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header */
.app-header {
    background-color: var(--primary-blue);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.app-header .subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-right label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.header-right input[type="date"] {
    padding: 0.5rem;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--success-green);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #218838;
}

.btn-secondary {
    background-color: white;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
}

.btn-secondary:hover {
    background-color: var(--light-blue);
}

.btn-danger {
    background-color: var(--error-red);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-danger-text {
    background-color: transparent;
    color: var(--error-red);
    border: 1px solid var(--error-red);
}

.btn-danger-text:hover {
    background-color: var(--error-red);
    color: white;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.btn-close:hover {
    color: #333;
}

/* Main Container */
.app-container {
    display: flex;
    height: calc(100vh - 140px);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: white;
    border-right: 1px solid var(--border-gray);
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}

.help-text {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 1rem;
}

.block-palette {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.palette-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem;
    background-color: var(--off-white);
    border: 2px solid var(--border-gray);
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    text-align: left;
    user-select: none;
}

.palette-btn:hover {
    background-color: var(--light-blue);
    border-color: var(--primary-blue);
    transform: translateX(4px);
}

.palette-btn:active {
    cursor: grabbing;
}

.palette-btn .icon {
    font-size: 1.5rem;
    pointer-events: none;
}

.palette-btn .label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary-blue);
    pointer-events: none;
}

.palette-ghost {
    opacity: 0.4;
}

.validation-panel {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-gray);
}

.validation-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}

#validation-messages {
    font-size: 0.75rem;
}

.validation-error {
    color: var(--error-red);
    margin: 0.5rem 0;
    padding: 0.5rem;
    background-color: #ffe6e6;
    border-left: 3px solid var(--error-red);
    border-radius: 3px;
}

.validation-success {
    color: var(--success-green);
    margin: 0.5rem 0;
    padding: 0.5rem;
    background-color: #e6ffe6;
    border-left: 3px solid var(--success-green);
    border-radius: 3px;
}

/* Canvas */
.canvas {
    flex: 1;
    background-color: #f9f9f9;
    padding: 1.5rem;
    overflow-y: auto;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.canvas-header h2 {
    font-size: 1.25rem;
    color: var(--primary-blue);
}

.canvas-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.blocks-container {
    min-height: 200px;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1rem;
    border: 2px dashed var(--border-gray);
    border-radius: 8px;
    background-color: white;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Block Cards */
.block-card {
    background-color: white;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    padding: .25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.block-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Fixed advertisement blocks */
.block-card-fixed {
    background-color: #2d2d2d0a;
    border-color: #999;
    border-style: dashed;
}

.block-card-fixed .block-header {
    border-bottom-color: #ccc;
}

.block-card-fixed .block-title .block-name {
    color: #666;
    font-style: italic;
}

/* Section Header blocks */
.block-card.block-type-section-header .block-header {
    background-color: var(--primary-blue);
    color: white;
    border-bottom: none;
    margin: -0.25rem -0.25rem 0 -0.25rem;
    padding: 0.75rem;
    border-radius: 6px 6px 0 0;
}

.block-card.block-type-section-header .block-header .block-title {
    color: white;
}

.block-card.block-type-section-header .block-header .block-name {
    color: white;
}

.block-card.block-type-section-header .block-header .block-summary {
    color: rgba(255, 255, 255, 0.8);
}

.block-card.block-type-section-header .block-header .drag-handle {
    color: rgba(255, 255, 255, 0.6);
}

.block-card.block-type-section-header .block-header:hover {
    background-color: #1e2f42;
}

.block-card.block-type-section-header .block-header .btn {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.block-card.block-type-section-header .block-header .btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.block-card.sortable-ghost {
    opacity: 0.4;
    background-color: var(--light-blue);
}

.block-card.sortable-chosen {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.block-card.sortable-drag {
    opacity: 0.8;
    transform: rotate(2deg);
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light-blue);
    cursor: pointer;
    user-select: none;
}

.block-header:hover {
    background-color: rgba(234, 246, 251, 0.3);
    margin: -0.5rem -1rem 1rem -1rem;
    padding: 0.5rem 1rem 0.75rem 1rem;
    border-radius: 4px 4px 0 0;
}

/* Non-clickable headers (for fixed ad blocks) */
.block-header.non-clickable {
    cursor: default;
}

.block-header.non-clickable:hover {
    background-color: transparent;
    margin: 0 0 1rem 0;
    padding: 0 0 0.75rem 0;
    border-radius: 0;
}

.block-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1rem;
    flex: 1;
    overflow: hidden;
}

.block-title .icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.block-title .block-name {
    flex-shrink: 0;
}

.block-title .block-summary {
    font-weight: 400;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.block-card.collapsed .block-header {
    margin-bottom: 0;
    padding-bottom: 0.5rem;
    border-bottom: none;
}

.block-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.toggle-collapse {
    min-width: 28px;
    font-size: 0.875rem;
}

.drag-handle {
    cursor: grab;
    padding: 0.25rem 0.5rem;
    color: #999;
    font-size: 1.25rem;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: #555;
    margin-bottom: 0.25rem;
}

.form-group label.required::after {
    content: " *";
    color: var(--error-red);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
}

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

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

.form-group .help-text {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Advertisement block info styling */
.ad-info {
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.ad-info p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.ad-info strong {
    color: var(--primary-blue);
}

/* Photo of the Day - Fixed Position */
.photo-of-day-fixed {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 3px solid var(--primary-blue);
}

/* Footer */
.app-footer {
    background-color: white;
    border-top: 1px solid var(--border-gray);
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: #666;
}

.keyboard-hints {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: #999;
}

.keyboard-hints kbd {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #333;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

#status-message {
    margin-top: 0.25rem;
    font-weight: 600;
}

#status-message.success {
    color: var(--success-green);
}

#status-message.error {
    color: var(--error-red);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-gray);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-blue);
}

.modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-body textarea {
    width: 100%;
    height: 500px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-gray);
}

/* Quill Editor Customization */
.quill-editor {
    background-color: white;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    overflow: hidden;
}

.quill-editor .ql-toolbar {
    background-color: #f9f9f9;
    border: none;
    border-bottom: 1px solid var(--border-gray);
}

.quill-editor .ql-container {
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
}

.quill-editor .ql-editor {
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
}

.quill-editor .ql-editor.ql-blank::before {
    color: #999;
    font-style: italic;
}

/* Quill focused state */
.quill-editor:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(45, 65, 93, 0.1);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
