/**
 * Slidia Generator - Interface de génération PowerPoint
 */

.slidia-generator {
    min-height: calc(100vh - 80px);
    padding: var(--spacing-2xl);
    background: var(--color-background);
}

.slidia-generator__container {
    display: grid;
    grid-template-columns: 25% 75%;
    gap: var(--spacing-2xl);
    max-width: 1600px;
    margin: 0 auto;
    height: calc(100vh - 140px);
}

/* ===== LEFT SIDE - SIDEBAR PARAMÈTRES (25%) ===== */
.slidia-generator__sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--border-radius-2xl);
    border: 1px solid rgba(12, 129, 228, 0.08);
    box-shadow: 0 4px 20px rgba(12, 129, 228, 0.08);
    overflow: hidden;
    position: relative;
}

/* Header avec design moderne */
.slidia-sidebar__header {
    padding: var(--spacing-2xl);
    background: linear-gradient(135deg, rgba(12, 129, 228, 0.05) 0%, rgba(58, 158, 235, 0.02) 100%);
    border-bottom: 1px solid rgba(12, 129, 228, 0.1);
    position: relative;
}

.slidia-sidebar__title-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.slidia-sidebar__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.slidia-sidebar__icon svg {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
}

.slidia-sidebar__title {
    font-size: 1.75rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    font-family: var(--font-secondary);
    margin: 0;
    line-height: 1;
    background: linear-gradient(135deg, var(--color-primary), #3A9EEB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.slidia-sidebar__subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
    font-weight: var(--font-weight-medium);
}

/* Content - Paramètres */
.slidia-sidebar__content {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

/* Coming Soon Message simple */
.slidia-coming-soon {
    text-align: center;
    padding: var(--spacing-2xl);
}

.slidia-coming-soon__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
    font-family: var(--font-secondary);
}

.slidia-coming-soon__text {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin: 0;
    max-width: 240px;
    margin-left: auto;
    margin-right: auto;
}

/* Theme Editor Block */
.slidia-theme-editor {
    width: 100%;
}

/* Section de paramètres */
.slidia-theme-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid rgba(12, 129, 228, 0.08);
}

.slidia-theme-section:last-of-type {
    margin-bottom: var(--spacing-md);
    padding-bottom: 0;
    border-bottom: none;
}

.slidia-theme-section__header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slidia-theme-section__header svg {
    color: var(--color-primary);
    opacity: 0.7;
}

/* Select pour les polices */
.slidia-theme-font-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid rgba(12, 129, 228, 0.15);
    border-radius: var(--border-radius-md);
    background: var(--color-white);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all 150ms ease;
}

.slidia-theme-font-select:hover {
    border-color: var(--color-primary);
}

.slidia-theme-font-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(12, 129, 228, 0.1);
}


/* Footer avec tokens et énergie - Design subtil */

.slidia-sidebar__stats {
    display: flex;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    border: 1px solid rgba(12, 129, 228, 0.08);
}

.slidia-stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    flex: 1;
    transition: all 300ms ease;
}

.slidia-stat-item:hover {
    opacity: 0.8;
}

/* Bordure séparatrice subtile */
.slidia-stat-item:first-child {
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

/* Tokens - Background bleu très subtil */
.slidia-stat-item:first-child {
    background: rgba(12, 129, 228, 0.04);
}

.slidia-stat-item:first-child .slidia-stat-icon {
    color: rgba(12, 129, 228, 0.7);
}

.slidia-stat-item:first-child .slidia-stat-value {
    color: var(--color-primary);
}

.slidia-stat-item:first-child .slidia-stat-label {
    color: rgba(12, 129, 228, 0.6);
}

/* Énergie - Background jaune très subtil */
.slidia-stat-item:last-child {
    background: rgba(255, 193, 7, 0.06);
}

.slidia-stat-item:last-child .slidia-stat-icon {
    color: rgba(245, 124, 0, 0.7);
}

.slidia-stat-item:last-child .slidia-stat-value {
    color: #f57c00;
}

.slidia-stat-item:last-child .slidia-stat-label {
    color: rgba(245, 124, 0, 0.6);
}

.slidia-stat-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.slidia-stat-icon--tokens svg {
    width: 16px;
    height: 16px;
}

.slidia-stat-icon--energy svg {
    width: 18px;
    height: 18px;
}

.slidia-stat-content {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-xs);
}

.slidia-stat-value {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    line-height: 1;
}

.slidia-stat-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
}

/* ===== RIGHT SIDE - EDITOR (75%) ===== */
.slidia-generator__editor {
    position: relative;
}

.slidia-generator__editor form {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-white);
    border-radius: var(--border-radius-2xl);
    border: 1px solid rgba(12, 129, 228, 0.12);
    box-shadow: 0 2px 8px rgba(12, 129, 228, 0.06);
    padding: var(--spacing-2xl);
}

.slidia-generator__textarea-wrapper {
    position: relative;
    flex: 1;
    display: flex;
}

/* Badge de statut (Formaté / Modifié) */
.slidia-generator__status-badge {
    position: absolute;
    top: 12px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--border-radius-full);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.01em;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    transition: all 250ms ease;
    animation: fadeInSlide 300ms ease;
    z-index: 10;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.slidia-generator__status-badge svg {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
}

.slidia-generator__status-badge.status--formatted {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
}

.slidia-generator__status-badge.status--modified {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}

.slidia-generator__char-count {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.4);
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    transition: all 200ms ease;
    z-index: 10;
}

.slidia-generator__char-count.warning {
    color: var(--color-warning);
    background: rgba(255, 251, 235, 0.95);
}

.slidia-generator__char-count.error {
    color: var(--color-error);
    background: rgba(254, 242, 242, 0.95);
}

.slidia-generator__textarea {
    flex: 1;
    width: 100%;
    padding: var(--spacing-lg);
    padding-bottom: 44px; /* Espace pour le compteur en bas à droite */
    font-size: var(--font-size-base);
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--color-background);
    border: 2px solid rgba(12, 129, 228, 0.12);
    border-radius: var(--border-radius-xl);
    resize: none;
    transition: border-color 300ms ease;
}

.slidia-generator__textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(12, 129, 228, 0.1);
}

.slidia-generator__textarea::placeholder {
    color: var(--color-text-tertiary);
}

.slidia-generator__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(12, 129, 228, 0.08);
}

.slidia-generator__help {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-dark);
    background: linear-gradient(135deg, rgba(12, 129, 228, 0.05), rgba(58, 158, 235, 0.02));
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-xl);
    border: 1px solid rgba(12, 129, 228, 0.1);
}

.slidia-generator__help svg {
    flex-shrink: 0;
    color: var(--color-primary);
}

.slidia-generator__help strong {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

/* Actions - Groupe de boutons */
.slidia-generator__actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Bouton de formatage */
.btn--format {
    position: relative;
    overflow: hidden;
}

.btn--format.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Icônes dans les boutons */
.slidia-generator__footer .btn svg {
    width: 18px;
    height: 18px;
}

.btn--format svg {
    width: 20px;
    height: 20px;
    transition: transform 300ms ease;
}

.btn--format:hover svg {
    transform: rotate(180deg);
}

.btn--format.loading svg {
    animation: rotate 1s linear infinite;
}

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

/* Loading state */
.slidia-generator__loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--border-radius-2xl);
    z-index: 10;
}

.slidia-generator__loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(12, 129, 228, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
    margin-bottom: var(--spacing-lg);
}

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

.slidia-generator__loading-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
}

.slidia-generator__loading-subtext {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .slidia-generator__container {
        grid-template-columns: 30% 70%;
    }
}

@media (max-width: 968px) {
    .slidia-generator__container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .slidia-generator__sidebar {
        order: 2;
        height: auto;
    }

    .slidia-generator__editor {
        order: 1;
    }

    .slidia-generator__editor form {
        min-height: 500px;
    }

    .slidia-generator__footer {
        flex-direction: column;
        align-items: stretch;
    }

    .slidia-generator__actions {
        flex-direction: column;
        width: 100%;
    }

    .slidia-generator__actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .slidia-generator {
        padding: var(--spacing-lg);
    }

    .slidia-generator__container {
        gap: var(--spacing-lg);
    }

    .slidia-sidebar__header,
    .slidia-sidebar__content{
        padding: var(--spacing-md);
    }

    .slidia-sidebar__title {
        font-size: 1.25rem;
    }

    .slidia-generator__editor form {
        padding: var(--spacing-lg);
    }
}
