/* ============================================================
   Publication Wizard CSS
   Full-page wizard with enhanced media library
   Uses CSS variables from style.css for consistency
   ============================================================ */

/* ============================================================
   FULL-PAGE OVERLAY
   ============================================================ */

.wizard-overlay {
    display: none; /* Shown via JavaScript */
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 3000;
    overflow: hidden;
}

.wizard-overlay.active {
    display: block;
}

/* ============================================================
   WIZARD CONTAINER (Header, Body, Footer)
   ============================================================ */

.wizard-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   WIZARD HEADER
   ============================================================ */

.wizard-header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--border-color);
    padding: 1.5rem 2rem;
    flex-shrink: 0;
}

.wizard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.wizard-title {
    color: var(--accent-color);
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.wizard-step-indicator {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ============================================================
   PROGRESS STEPS
   ============================================================ */

.wizard-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.wizard-step .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.wizard-step.completed .step-number {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.wizard-step.completed .step-number::before {
    content: "✓";
}

.wizard-step.completed .step-number span {
    display: none;
}

.wizard-step.active {
    color: var(--accent-color);
}

.wizard-step.active .step-number {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

.wizard-step .step-label {
    font-weight: 600;
}

/* ============================================================
   WIZARD BODY (Main Content Area)
   ============================================================ */

.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    background: var(--bg-gradient);
}

/* Custom scrollbar for wizard body */
.wizard-body::-webkit-scrollbar {
    width: 8px;
}

.wizard-body::-webkit-scrollbar-track {
    background: transparent;
}

.wizard-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.wizard-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ============================================================
   STEP CONTENT
   ============================================================ */

.wizard-step-content {
    display: none;
}

.wizard-step-content.active {
    display: block;
    max-width: 900px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-step-content h2 {
    color: var(--text-color);
    margin-bottom: 2rem;
    font-size: 2rem;
    border-left: 6px solid var(--accent-color);
    padding-left: 1rem;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.wizard-form-group {
    margin-bottom: 1.5rem;
}

.wizard-label {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.wizard-input,
.wizard-textarea,
.wizard-select {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.wizard-input:focus,
.wizard-textarea:focus,
.wizard-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.wizard-input::placeholder,
.wizard-textarea::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

.wizard-textarea {
    resize: vertical;
    min-height: 120px;
}

.wizard-help-text {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.wizard-form-row {
    display: grid;
    gap: 1rem;
}

.wizard-form-row.cols-2 {
    grid-template-columns: 2fr 1fr;
}

/* ============================================================
   MEDIA LIBRARY (KRITISCH - KERNFEATURE!)
   ============================================================ */

.media-library-fullpage {
    height: 70vh; /* Deutlich größer als vorher (350px) */
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Media Navigation Bar */
.media-nav {
    background: rgba(30, 41, 59, 0.9);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.media-search {
    max-width: 300px;
    margin: 0;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
}

.media-nav-spacer {
    flex: 1;
}

.media-view-toggle {
    display: flex;
    gap: 0.5rem;
}

/* Media Grid Container */
.media-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Custom scrollbar for media grid */
.media-grid-container::-webkit-scrollbar {
    width: 8px;
}

.media-grid-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.media-grid-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.media-grid-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

/* Media Item (Image or Folder) */
.media-item {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: rgba(2, 6, 23, 0.8);
}

.media-item:hover {
    transform: translateY(-4px);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.media-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
    transform: translateY(-4px);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Checkmark overlay on selected items */
.media-item .checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.media-item.selected .checkmark {
    opacity: 1;
}

/* Filename overlay at bottom */
.media-item .filename {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    color: white;
    font-size: 0.7rem;
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Folder item styling */
.media-item.folder {
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.media-item.folder::before {
    content: "📁";
    font-size: 2.5rem;
}

.media-item.folder .folder-name {
    font-size: 0.8rem;
    text-align: center;
    padding: 0 0.5rem;
    word-break: break-word;
    color: var(--text-color);
    max-width: 100%;
}

/* Empty state */
.media-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-dim);
    font-style: italic;
}

/* ============================================================
   SELECTED PREVIEW (Large preview below grid)
   ============================================================ */

.selected-preview-large {
    width: 100%;
    max-height: 400px;
    background: rgba(2, 6, 23, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-height: 200px;
}

.selected-preview-large img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.selected-preview-large .preview-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent-color);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
}

.selected-preview-large .no-selection {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.95rem;
}

/* ============================================================
   REVIEW STEP
   ============================================================ */

.review-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.review-section {
    margin-bottom: 2rem;
}

.review-section:last-child {
    margin-bottom: 0;
}

.review-section h4 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-field {
    margin-bottom: 1rem;
}

.review-field-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.review-field-value {
    color: var(--text-color);
    font-size: 1rem;
}

.review-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.review-edit-link {
    color: var(--accent-color);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 0.5rem;
    display: inline-block;
}

.review-edit-link:hover {
    color: var(--accent-hover);
}

/* ============================================================
   WIZARD FOOTER (Action Buttons)
   ============================================================ */

.wizard-footer {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.wizard-footer-actions {
    display: flex;
    gap: 1rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.wizard-btn {
    padding: 0.8rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-family: inherit;
}

.wizard-btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.wizard-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.wizard-btn-secondary {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

.wizard-btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.wizard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.wizard-btn-icon {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.wizard-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.wizard-loading.active {
    display: flex;
}

.wizard-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   ERROR MESSAGES
   ============================================================ */

.wizard-error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    color: #fca5a5;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: none;
}

.wizard-error.active {
    display: block;
}

.wizard-error-icon {
    margin-right: 0.5rem;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
    .wizard-body {
        padding: 1rem;
    }

    .wizard-header {
        padding: 1rem;
    }

    .wizard-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .wizard-progress {
        gap: 0.5rem;
        font-size: 0.8rem;
        overflow-x: auto;
        width: 100%;
        justify-content: flex-start;
    }

    .wizard-step .step-label {
        display: none;
    }

    .wizard-step {
        flex-direction: column;
        gap: 0.25rem;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
    }

    .media-library-fullpage {
        height: 60vh;
    }

    .wizard-form-row.cols-2 {
        grid-template-columns: 1fr;
    }

    .wizard-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .wizard-footer-actions {
        width: 100%;
    }

    .wizard-btn {
        flex: 1;
        width: 100%;
    }

    .selected-preview-large {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .wizard-step-content h2 {
        font-size: 1.5rem;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .media-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .media-search {
        max-width: 100%;
    }
}
