/* =============================================================================
   MAIN.CSS — Tokens universels + composants transversaux
   =============================================================================
   Chargé sur TOUTES les pages PHP (signin, dashboard, admin, editor, view…).
   Ne contient que :
     1. Variables CSS (tokens de design)
     2. Reset et base typographique
     3. Composants UI réutilisables sur n'importe quelle page
   Ce fichier ne définit PAS de thème sombre — c'est le rôle de app.css.
   ============================================================================= */


/* =============================================================================
   1. TOKENS DE DESIGN (-> tokens.css)
   ============================================================================= */


/* =============================================================================
   2. RESET ET BASE
   ============================================================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Lexend", sans-serif;
    line-height: 1.6;
    min-height: 100dvh;
}
button {
    color:inherit;
}

/* Classe utilitaire pour forcer la police Lexend */
.lexend-mlc {
    font-family: "Lexend", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}


/* =============================================================================
   3. LAYOUT — Containers
   ============================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    scroll-padding-top: 160px;
    touch-action: pan-y;
}

.container-small {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

@media (max-width: 768px) {
    .container { padding: 0 var(--spacing-md); }
}

@media (max-width: 480px) {
    .container { padding: 0; }
}


/* =============================================================================
   4. HEADER — Squelette structurel (thème dans app.css)
   ============================================================================= */
header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    padding: 1em;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.header-content h1 {
    flex: 1 1 auto;
    text-align: left;
}

.header-content .top-buttons {
    font-size: 0.7em;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.header-subtitle {
    transition: all 0.3s ease;
    font-size: clamp(0.8rem, 2vw, 1rem);
}

.header-subtitle.hidden {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
}

/* Logo */
#logo {
    position: relative;
    width: clamp(80px, 15vw, 120px);
    height: 50px;
    background: url(../img/mlc-black.svg) center / contain no-repeat;
    display: block;
    z-index: 9;
    margin: auto;
    transition: all 0.3s;
}

.header-logo-img {
    width: clamp(80px, 15vw, 120px);
    height: 50px;
}


/* =============================================================================
   5. BOUTONS
   ============================================================================= */
.btn {
    display: inline-block;
    padding: clamp(0.5rem, 1vw, var(--spacing-sm)) clamp(0.5rem, 1vw, var(--spacing-lg));
    border: none;
    border-radius: var(--radius-md);
    font-size: clamp(0.8rem, 2vw, 1rem);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border: 2px solid var(--color-primary);
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    padding: 0 0.5em;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 1.4em;
    transition: all 0.2s;
    white-space: nowrap;
    align-self: center;
    margin: 0 0.5em;
}

.btn-secondary:hover {
    background: rgba(102, 126, 234, 0.12);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border: 2px solid var(--color-danger);
}

.btn-danger:hover {
    filter: brightness(1.15);
}

/* Taille réduite */
.btn-small {
    padding: 5px 12px;
    font-size: 0.82rem;
}

/* Pleine largeur (signin, modales) */
.btn-block {
    display: block;
    width: 100%;
}

/* Bouton icône sans fond */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color:inherit;
    font-size: 0.95rem;
    padding: 2px 5px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.btn-icon:hover { opacity: 1; }

/* Highlight de sauvegarde */
#saveBottom {
    z-index: 9;
    display: block;
    position: fixed;
    bottom: calc(var(--keyboard-offset, 0px) + 16px);
    top: auto;
    right: 20px;
    opacity: 0;
    transition: all 0.3s;
}
#saveBottom.active { opacity: 1; }

.btn-save.highlight,
.highlight {
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
    transform: scale(1.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

@media (max-width: 768px) {
    #saveBottom {
        right: 0;
        bottom: calc(var(--keyboard-offset, 0px));
        padding: 1em;
        border: 0.5em solid;
    }
}


/* =============================================================================
   6. NAVIGATION RAPIDE (quick-zone / quick-item)
   Utilisé par dashboard.php et editor-immersive.php
   ============================================================================= */
.quick-zone {
    max-width: 450px;
    margin: 15px auto 0;
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    justify-content: space-around;
}

.quick-item {
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    border: none;
    padding: 0.5em;
    background: none;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-item:hover {
    scale: 1.1;
    border-radius: var(--radius-md);
}


/* =============================================================================
   7. FORMULAIRES
   ============================================================================= */
.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: var(--spacing-xs);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: inherit;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder,
select::placeholder {
    font-style: italic;
    opacity: 0.6;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

textarea.iframe-code-display {
    font-family: monospace;
    font-size: 0.85em;
    resize: vertical;
}

/* Ligne input + bouton côte à côte */
.input-action-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Input lecture seule */
.input-readonly {
    flex: 1;
    opacity: 0.6;
}

/* Texte d'aide sous un champ */
.field-hint {
    font-size: 0.78rem;
    opacity: 0.5;
}

/* Bloc de boutons de soumission */
.form-actions {
    margin-top: 20px;
}

/* Feedback de formulaire */
.form-feedback {
    min-height: 20px;
    font-size: 0.85rem;
    margin-top: 10px;
    border-radius: var(--radius-md);
}
.form-feedback.success { color: var(--color-success); }
.form-feedback.error   { color: var(--color-danger);  }
.form-feedback.info    { color: #90caf9; }

/* Séparateur */
.divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}


/* =============================================================================
   8. TOGGLE SWITCH (interrupteur on/off)
   ============================================================================= */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 12px;
}
.toggle-row:last-of-type { border-bottom: none; }

.toggle-label {
    font-size: 0.9rem;
    line-height: 1.3;
}

.toggle-desc {
    font-size: 0.78rem;
    opacity: 0.55;
    margin-top: 3px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #444;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider           { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider::before  { transform: translateX(20px); }


/* =============================================================================
   9. COMPOSANTS DE CONTENU
   ============================================================================= */

/* ── Panneau générique ── */
.card {
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    font-size: clamp(0.8rem, 2vw, 1rem);
    touch-action: pan-y;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header h2 {
    color: var(--color-primary);
    font-size: clamp(1rem, 3vw, 1.4em);
    flex: 1 1 auto;
}

/* Décalage ancre avec header fixe */
.step-card {
    scroll-margin-top: 160px;
}
.step-card h3 {
    font-size: clamp(1.1em, 2vw, 1.2em);
}

/* ── Onglets (tab panels) ── */
.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* ── État vide ── */
.empty-state {
    padding: 48px;
    text-align: center;
    opacity: 0.7;
}

/* ── Séparateur de description ── */
.section-description {
    font-size: 0.83rem;
    opacity: 0.55;
    margin-top: -14px;
    margin-bottom: 16px;
}


/* =============================================================================
   10. ALERTES
   ============================================================================= */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border-width: 2px;
    border-style: solid;
}
.alert-success { border-color: var(--color-success); color: var(--color-success); }
.alert-error   { border-color: var(--color-danger);  color: var(--color-danger);  }
.alert-info    { border-color: var(--color-primary);  color: var(--color-primary); }


/* =============================================================================
   11. MODAL PREVIEW CAPSULE
   ============================================================================= */

/* Overlay plein écran — fond sombre + centrage de .modal-content */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.modal.hidden { display: none; }

/* Boîte modale — laisse ~6% de marge sur chaque côté */
.modal-content {
    position: relative;
    width: 88%;
    max-width: 1100px;
    height: 84vh;
    background: var(--modal-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    cursor: default;
}

/* ── Header : fond primary-glass, texte blanc ── */
.modal-header {
    flex-shrink: 0;
    height: var(--modal-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 16px;
    background: var(--color-primary-glass);
    border-bottom: 1px solid var(--border-white-subtle);
    color: #fff;
    gap: 12px;
}

/* Zone gauche : titre + vues */
.modal-header__info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

/* Titre tronqué */
.modal-header__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Compteur de vues */
.modal-header__views {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--text-white-sub);
    white-space: nowrap;
    flex-shrink: 0;
}
.modal-header__views .material-symbols-outlined {
    font-size: 1rem;
}

/* Zone droite : boutons d'action */
.modal-header__actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Boutons dans le header modal — blancs sur fond primary */
.modal-header__actions .btn-secondary {
    color: var(--text-white-sub);
    font-size: 1.3em;
    margin: 0 2px;
    padding: 4px 8px;
}
.modal-header__actions .btn-secondary:hover {
    background: var(--hover-white);
    color: #fff;
}

/* Le bouton close est dans le flux, pas en position absolute */
.modal-close {
    position: static;
}

/* ── Corps : iframe plein ── */
.modal-body {
    position: relative;
    flex: 1;
    min-height: 0;
}
.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Overlay transparent par-dessus l'iframe.
   L'iframe absorbe tous les événements pointer — cet overlay permet de fermer
   la modale en cliquant dans la zone body quand l'iframe a le focus. */
#modalIframeOverlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: pointer;
}

/* ── Responsive mobile ── */
@media (max-width: 768px) {
    .modal-content        { width: 94%; height: 88vh; }
    .modal-header__title  { font-size: 0.85rem; }
    .modal-header__views  { display: none; }
}


/* =============================================================================
   12. MODAL DE PARTAGE
   Généré dynamiquement par share-utils.js — utilisé sur dashboard et editor.
   ============================================================================= */
.share-modal {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s;
    overflow-y: auto;
}

.share-modal-content {
    background: #1e1e3a;
    border: 1px solid #2a2a4a;
    border-radius: var(--radius-lg);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.share-modal-header h3 {
    margin: 0;
    color: #e0e0f0;
}

.share-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.share-close:hover { color: var(--color-danger); }

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

.share-section {
    margin-bottom: 30px;
}
.share-section:last-child { margin-bottom: 0; }

.share-section h4 {
    color: #a0a8ff;
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, 50px);
    gap: 15px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s;
    color: #e0e0f0;
}
.share-btn svg   { width: 24px; height: 24px; flex-shrink: 0; }
.share-btn span  { display: none; }
.share-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }

/* Couleurs réseau au survol */
.share-facebook:hover { background: #1877f2; border-color: #1877f2; color: #fff; }
.share-twitter:hover  { background: #000;    border-color: #000;    color: #fff; }
.share-linkedin:hover { background: #0a66c2; border-color: #0a66c2; color: #fff; }
.share-whatsapp:hover { background: #25d366; border-color: #25d366; color: #fff; }
.share-email:hover    { background: #ea4335; border-color: #ea4335; color: #fff; }
.share-copy:hover     { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.share-section textarea.iframe-code-display {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    background: #13132a;
    font-family: monospace;
    font-size: 0.85em;
    resize: vertical;
    margin-bottom: 12px;
    color: #e0e0f0;
}

@media (max-width: 768px) {
    .share-modal-content { max-width: 95%; max-height: 95vh; }
    .share-modal-body    { padding: 15px; }
}
@media (max-width: 480px) {
    .share-btn { padding: 10px 12px; }
    .share-btn span { font-size: 0.85em; }
}

/* =============================================================================
   MODALE DEEP LINK CRÉATION
   ============================================================================= */
.create-pano-modal-content {
    max-width: 460px;
}
.create-pano-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--spacing-lg) 0;
}
.create-pano-desc strong {
    color: var(--text-primary);
}
.create-pano-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* =============================================================================
   13. BADGES ET UTILITAIRES
   ============================================================================= */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-success { background: rgba(69,  186, 128, 0.15); color: var(--color-success); }
.badge-warning { background: rgba(255, 159,  64, 0.15); color: var(--color-warning); }
.badge-danger  { background: rgba(255, 107, 107, 0.15); color: var(--color-danger);  }
.badge-info    { background: rgba(102, 126, 234, 0.15); color: var(--color-primary); }

.text-muted { font-size: 0.8rem; opacity: 0.5; }


/* =============================================================================
   14. SPINNER DE CHARGEMENT
   ============================================================================= */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: var(--spacing-lg) auto;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes popIn {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}


/* =============================================================================
   15. FOOTER
   ============================================================================= */
footer {
    text-align: center;
    padding: 0 var(--spacing-xs);
}
footer.page-footer {
    font-size: 0.7rem;
    padding-bottom: 75px;
}
