/* ============================================
   MODALS.CSS - Modais do Sistema
   ============================================ */

/* ===== OVERLAY ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(2px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== MODAL BASE ===== */
.modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover { background: #f0f0f0; color: #333; }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: white;
    color: #333;
}

.btn-secondary:hover { background: #f0f0f0; }

.btn-danger {
    background: #c0392b;
    color: white;
    border-color: #c0392b;
}

.btn-danger:hover { background: #a93226; }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #444;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45,90,39,0.1);
}

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

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group { flex: 1; }

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== IMAGE INSERT MODAL ===== */
.image-preview-container {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    margin-top: 10px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.image-preview-container.has-image {
    border-style: solid;
    border-color: var(--accent);
    background: #f9f9f9;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
}

.image-preview-container .placeholder {
    color: #aaa;
    font-size: 0.9rem;
}

.image-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.image-tab {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}

.image-tab:hover { color: #333; }
.image-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===== TEMPLATE SELECTOR ===== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.template-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.template-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(45,90,39,0.15);
}

.template-card.active {
    border-color: var(--accent);
    background: #f0f7ef;
}

.template-card .template-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.template-card .template-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.template-card .template-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== THEME EDITOR ===== */
.theme-editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.theme-editor-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-group input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

.color-input-group input[type="text"] {
    flex: 1;
}

.theme-preview-live {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-y: auto;
    max-height: 400px;
    background: white;
}

/* ===== PROJECT MANAGER ===== */
.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: all var(--transition);
    cursor: pointer;
}

.project-item:hover {
    border-color: var(--accent);
    background: #f9f9f9;
}

.project-item .project-info {
    flex: 1;
}

.project-item .project-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.project-item .project-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.project-item .project-actions {
    display: flex;
    gap: 6px;
}

/* ===== EXPORT SETTINGS ===== */
.export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.export-option:hover { border-color: var(--accent); }
.export-option.selected { border-color: var(--accent); background: #f0f7ef; }

.export-option .export-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.export-option .export-info h4 {
    margin: 0 0 2px 0;
    font-size: 0.95rem;
}

.export-option .export-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== KEYBOARD SHORTCUTS MODAL ===== */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-toolbar);
    border-radius: var(--radius-sm);
}

.shortcut-item .shortcut-desc {
    font-size: 0.85rem;
    color: #444;
}

.shortcut-item kbd {
    background: white;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ===== VERSION HISTORY ===== */
.version-list {
    list-style: none;
    padding: 0;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-left: 3px solid var(--border);
    margin-bottom: 8px;
    transition: all var(--transition);
}

.version-item:hover { border-left-color: var(--accent); background: #f9f9f9; }
.version-item.current { border-left-color: var(--accent); background: #f0f7ef; }

.version-item .version-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.version-item .version-size {
    font-size: 0.75rem;
    color: #999;
}
