/* SZMC Geriatrics Presentation Maker - Generator Modal Styles */

/* Modal Base */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.generator-modal-content {
    width: 90%;
    max-width: 1100px;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    font-size: 1.25rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

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

.generator-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.generator-input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.generator-input-section textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
    background: #f9fafb;
}

.generator-input-section textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.generator-input-section textarea::placeholder {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Detected Type Display */
.detected-type {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 0.9rem;
}

.detected-type.case {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.detected-type.journal {
    background: #ddd6fe;
    border-color: #a78bfa;
    color: #5b21b6;
}

.detected-type i {
    font-size: 1.1rem;
}

/* Options Section */
.generator-options-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.generator-options-section h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: #6b7280;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group select {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Theme Preview */
.theme-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.preview-colors {
    display: flex;
    gap: 4px;
}

.preview-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-color.primary { background: var(--primary-color, #1e40af); }
.preview-color.secondary { background: var(--primary-light, #3b82f6); }
.preview-color.accent { background: var(--accent-color, #60a5fa); }

.preview-label {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4b5563;
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: #1f2937;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4b5563;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.radio-label:hover {
    background: #f3f4f6;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
    color: #1e40af;
    font-weight: 500;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-footer .btn-secondary,
.modal-footer .btn-primary {
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-footer .btn-secondary {
    background: white;
    border: 1px solid #d1d5db;
    color: #4b5563;
}

.modal-footer .btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.modal-footer .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

/* Landing Page Enhancements */
.template-card-generate {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px dashed #0ea5e9;
}

.template-card-generate:hover {
    border-style: solid;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.template-card-generate .template-icon {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
}

.load-section {
    margin-top: 32px;
    text-align: center;
}

.load-section .btn-secondary {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 2px solid #e5e7eb;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.load-section .btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Theme Panel in Editor */
.theme-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 100;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
}

.theme-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-panel h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-panel select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Theme-specific CSS Variables */
:root {
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --accent-color: #60a5fa;
    --background-color: #ffffff;
    --text-color: #1f2937;
    --header-font: 'Merriweather', serif;
    --body-font: 'Inter', sans-serif;
}

/* Theme: SZMC Blue (default) */
[data-theme="szmc-blue"] {
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --accent-color: #60a5fa;
}

/* Theme: Clinical Green */
[data-theme="clinical-green"] {
    --primary-color: #047857;
    --primary-light: #059669;
    --accent-color: #34d399;
}

/* Theme: Modern Purple */
[data-theme="modern-purple"] {
    --primary-color: #5b21b6;
    --primary-light: #7c3aed;
    --accent-color: #a78bfa;
}

/* Theme: Warm Orange */
[data-theme="warm-orange"] {
    --primary-color: #c2410c;
    --primary-light: #ea580c;
    --accent-color: #fb923c;
    --background-color: #fffbeb;
}

/* Theme: Dark Professional */
[data-theme="dark-professional"] {
    --primary-color: #1f2937;
    --primary-light: #374151;
    --accent-color: #60a5fa;
    --background-color: #111827;
    --text-color: #f9fafb;
}

/* Theme: Medical Red */
[data-theme="medical-red"] {
    --primary-color: #b91c1c;
    --primary-light: #dc2626;
    --accent-color: #f87171;
}

/* Theme: Minimal Gray */
[data-theme="minimal-gray"] {
    --primary-color: #374151;
    --primary-light: #6b7280;
    --accent-color: #9ca3af;
    --background-color: #f9fafb;
}

/* Theme: Navy & Gold */
[data-theme="navy-gold"] {
    --primary-color: #1e3a5f;
    --primary-light: #2563eb;
    --accent-color: #fbbf24;
}

/* Animation for detected type change */
@keyframes typeDetected {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.detected-type.animate {
    animation: typeDetected 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .generator-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 16px;
    }

    .generator-options-section {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .modal-footer .btn-secondary,
    .modal-footer .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* Loading state for generation */
.generating {
    position: relative;
    pointer-events: none;
}

.generating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.generating::before {
    content: 'Generating...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    font-weight: 600;
    color: #1e40af;
}

/* Template grid enhancement for 3 cards */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

@media (min-width: 900px) {
    .template-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Presentation Options Modal */
.presentation-options-content {
    max-width: 550px;
}

.presentation-options-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
}

.presentation-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.mode-option {
    padding: 20px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.mode-option:hover {
    border-color: var(--primary-color, #3b82f6);
    background: #eff6ff;
    transform: translateY(-2px);
}

.mode-option i {
    font-size: 1.75rem;
    color: var(--primary-color, #3b82f6);
    margin-bottom: 12px;
    display: block;
}

.mode-option h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.mode-option p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
}

/* Keyboard Hints */
.keyboard-hints {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.keyboard-hints h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.keyboard-hints h4 i {
    color: #6b7280;
}

.hint-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 0.85rem;
}

.hint-grid kbd {
    display: inline-block;
    padding: 3px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.hint-grid span:nth-child(even) {
    color: #6b7280;
}

/* Transition Options */
.transition-options {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.transition-options label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}

.transition-options select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.transition-options select:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: #1f2937;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: #059669;
}

.toast-warning {
    background: #d97706;
}

.toast-error {
    background: #dc2626;
}

.toast i {
    font-size: 1.1rem;
}

/* Slide Actions */
.slide-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

.btn-action i {
    width: 16px;
    color: #64748b;
}

.btn-help {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-help:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

/* Shortcuts Modal */
.shortcuts-modal-content {
    max-width: 700px;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.shortcut-category h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color, #1e40af);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.875rem;
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 4px;
}

.shortcut-keys kbd {
    display: inline-block;
    padding: 4px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shortcut-desc {
    color: #6b7280;
}

.shortcuts-tip {
    margin-top: 20px;
    padding: 16px;
    background: #fef3c7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #92400e;
    font-size: 0.875rem;
}

.shortcuts-tip i {
    color: #f59e0b;
    font-size: 1.2rem;
}

/* Drag over state for slide canvas */
#current-slide.drag-over {
    outline: 3px dashed var(--primary-color, #3b82f6);
    outline-offset: -3px;
}

#current-slide.drag-over::after {
    content: 'Drop image here';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    font-weight: 500;
    pointer-events: none;
}

/* Theme button in header */
.btn-theme {
    width: 40px !important;
    height: 40px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-theme i {
    font-size: 1rem;
}

/* Responsive shortcuts grid */
@media (max-width: 600px) {
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }

    .shortcuts-modal-content {
        max-height: 80vh;
        overflow-y: auto;
    }
}
