/* ============================================
   OUTPUT PANEL - Material Design 3
   ============================================ */

/* ============================================
   MASTER BLUEPRINT SECTION
   ============================================ */

.blueprint-section {
    background: linear-gradient(135deg, #1a1f35 0%, #0d1117 100%);
    border: 2px solid #4f8cff;
    border-radius: var(--md-sys-shape-corner-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 24px rgba(79, 140, 255, 0.15);
}

.blueprint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.blueprint-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.blueprint-icon {
    font-size: 24px;
}

.blueprint-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.blueprint-badge {
    background: linear-gradient(135deg, #4f8cff 0%, #1a73e8 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.blueprint-description {
    margin-bottom: 12px;
}

.blueprint-description p {
    margin: 0;
    font-size: 12px;
    color: #8b949e;
    line-height: 1.5;
}

.blueprint-code {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: var(--md-sys-shape-corner-md);
    padding: 12px;
    margin: 0 0 12px 0;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #7ee787;
}

.blueprint-code code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
}

.blueprint-actions {
    display: flex;
    gap: 10px;
}

.btn-blueprint-download {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
    color: white;
    border: none;
    border-radius: var(--md-sys-shape-corner-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-blueprint-download:hover {
    background: linear-gradient(135deg, #2ea043 0%, #3fb950 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 160, 67, 0.3);
}

.btn-blueprint-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: var(--md-sys-shape-corner-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-blueprint-copy:hover {
    color: #fff;
    border-color: #4f8cff;
    background: rgba(79, 140, 255, 0.1);
}

/* ============================================
   VISUAL SAMPLES SECTION
   ============================================ */

.samples-section {
    margin-bottom: 16px;
}

.samples-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.samples-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 8px;
}

.samples-badge {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.samples-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-md);
    margin-top: 12px;
}

.disclaimer-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.samples-disclaimer p {
    margin: 0;
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
}

.samples-disclaimer strong {
    color: var(--md-sys-color-primary);
}

.output-carousel {
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
}

.carousel-placeholder {
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.placeholder-icon {
    font-size: 40px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.carousel-placeholder p {
    font-size: 13px;
}

.carousel-images {
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
}

.carousel-item {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--md-sys-shape-corner-md);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.carousel-item:hover,
.carousel-item.active {
    border-color: var(--md-sys-color-primary);
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   JSON EXPORT - Code Block Style
   ============================================ */
.json-export {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    overflow: hidden;
    margin-bottom: 12px;
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--md-sys-color-surface-variant);
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.export-header h4 {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

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

.btn-export {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    color: var(--md-sys-color-primary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--md-sys-typescale-body);
}

.btn-export:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.export-code {
    padding: 12px;
    margin: 0;
    font-family: var(--md-sys-typescale-mono);
    font-size: 10px;
    color: var(--md-sys-color-on-surface);
    overflow: auto;
    max-height: 180px;
    background: var(--md-sys-color-surface);
    line-height: 1.5;
}

/* ============================================
   OUTPUT ACTIONS - MD3 Buttons
   ============================================ */
.output-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--md-sys-shape-corner-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--md-sys-typescale-body);
}

.btn-generate {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-generate:hover:not(:disabled) {
    background: var(--md-sys-color-primary-hover);
    box-shadow: var(--md-sys-elevation-1);
}

.btn-save {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.btn-save:hover:not(:disabled) {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

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

/* ============================================
   PROCESSING OVERLAY - Clean Loading State
   ============================================ */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 249, 250, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.processing-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

.processing-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 3px solid var(--md-sys-color-outline);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.processing-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.processing-step {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 13px;
    margin-bottom: 20px;
}

.processing-progress {
    width: 240px;
    height: 4px;
    background: var(--md-sys-color-outline);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--md-sys-color-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ============================================
   TOAST NOTIFICATIONS - MD3 Snackbar
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--md-sys-color-on-surface);
    border-radius: var(--md-sys-shape-corner-md);
    box-shadow: var(--md-sys-elevation-2);
    animation: slideUp 0.2s ease;
    min-width: 280px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.success {
    background: var(--md-sys-color-success);
}

.toast.error {
    background: var(--md-sys-color-error);
}

.toast.info {
    background: #3C4043;
}

.toast-icon {
    font-size: 18px;
    color: white;
}

.toast-message {
    font-size: 13px;
    color: white;
    font-weight: 500;
}

/* ============================================
   GENERATED IMAGES - Imagen 3 Output
   9 Images Layout (3 segments x 3 variations)
   ============================================ */

/* Main container for campaign output */
.campaign-output-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
    width: 100%;
    max-height: 600px;
    overflow-y: auto;
}

/* Each segment section (A, B, C) */
.segment-section {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-lg);
    border: 1px solid var(--md-sys-color-outline);
    overflow: hidden;
}

.segment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-variant);
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.segment-badge.large {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.segment-section[data-segment="B"] .segment-badge.large {
    background: var(--md-sys-color-secondary);
}

.segment-section[data-segment="C"] .segment-badge.large {
    background: var(--md-sys-color-tertiary);
}

.segment-header .segment-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.variation-count {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px 8px;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-sm);
}

/* Grid of 3 variations per segment */
.variations-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
}

.no-images {
    grid-column: 1 / -1;
    padding: 30px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 13px;
}

/* Variation label */
.variation-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
}

/* Model badge in footer */
.model-badge {
    font-size: 9px;
    padding: 2px 6px;
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Legacy grid support */
.generated-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
    width: 100%;
}

.generated-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-md);
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline);
    transition: all 0.2s ease;
}

.generated-card:hover {
    box-shadow: var(--md-sys-elevation-2);
    border-color: var(--md-sys-color-primary);
}

.generated-card.success {
    border-color: var(--md-sys-color-success);
}

.generated-card.error {
    border-color: var(--md-sys-color-error);
}

.image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--md-sys-color-surface-variant);
    overflow: hidden;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.generated-card:hover .image-wrapper img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.generated-card:hover .image-overlay {
    opacity: 1;
}

.btn-download {
    padding: 8px 16px;
    background: var(--md-sys-color-primary);
    color: white;
    border: none;
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-download:hover {
    background: var(--md-sys-color-primary-hover);
    transform: scale(1.05);
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--md-sys-color-outline);
}

.segment-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
}

.segment-title {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.status-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 10px;
}

.status-badge.success {
    background: rgba(30, 142, 62, 0.1);
    color: var(--md-sys-color-success);
}

.status-badge.error {
    background: rgba(217, 48, 37, 0.1);
    color: var(--md-sys-color-error);
}

/* Error State */
.error-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(217, 48, 37, 0.05);
}

.error-content {
    text-align: center;
    padding: 16px;
}

.error-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.error-text {
    font-size: 11px;
    color: var(--md-sys-color-error);
    display: block;
}

/* Loading State */
.carousel-loading {
    width: 100%;
    padding: 16px;
}

.loading-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.loading-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-md);
    border: 1px solid var(--md-sys-color-outline);
    overflow: hidden;
    padding-bottom: 12px;
}

.loading-shimmer {
    aspect-ratio: 1 / 1;
    background: linear-gradient(90deg,
            var(--md-sys-color-surface-variant) 0%,
            var(--md-sys-color-surface) 50%,
            var(--md-sys-color-surface-variant) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.loading-label {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-top: 8px;
}

.loading-status {
    display: block;
    text-align: center;
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

.loading-hint {
    text-align: center;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 12px;
    margin-bottom: 0;
}

/* Error State in Carousel */
.carousel-error {
    text-align: center;
    padding: 32px;
    width: 100%;
}

.error-icon-large {
    font-size: 48px;
    margin-bottom: 12px;
}

.carousel-error h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-error);
    margin-bottom: 8px;
}

.carousel-error p {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
}

.btn-retry {
    padding: 10px 20px;
    background: var(--md-sys-color-primary);
    color: white;
    border: none;
    border-radius: var(--md-sys-shape-corner-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-retry:hover {
    background: var(--md-sys-color-primary-hover);
    box-shadow: var(--md-sys-elevation-1);
}

/* Button spinner */
.btn-action .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

.btn-action.success {
    background: var(--md-sys-color-success);
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .generated-images-grid {
        grid-template-columns: 1fr;
    }

    .loading-grid {
        grid-template-columns: 1fr;
    }
}