/* =============================================
   PHOTOLANGAGE - Frontend Styles v2
   ============================================= */

/* ---- Bloc d'accueil ---- */

.phl-welcome-block {
    max-width: 960px;
    margin: 20px auto 0 auto;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    padding: 24px 28px;
    font-size: 15px;
    line-height: 1.6;
    color: #1d2327;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.phl-welcome-block p:first-child { margin-top: 0; }
.phl-welcome-block p:last-child { margin-bottom: 0; }
.phl-welcome-block a { color: #2271b1; }
.phl-welcome-block ul, .phl-welcome-block ol { padding-left: 20px; }

/* ---- Rejoindre une session ---- */

.phl-session-join-box {
    max-width: 960px;
    margin: 20px auto;
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #2271b1;
    border-radius: 8px;
    padding: 20px 24px;
}

.phl-session-join-box h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
}

.phl-join-form {
    display: flex;
    align-items: center;
}

.phl-join-form input[type="text"] {
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #8c8f94;
    border-radius: 6px;
    margin-right: 20px;
}

#phl-join-code {
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 700;
    font-family: monospace;
    font-size: 18px;
    width: 280px;
}

#phl-join-name {
    width: 200px;
}

.phl-btn-join {
    background: #2271b1;
    color: #fff;
    margin-left: 4px;
}
.phl-btn-join:hover { background: #135e96; }

.phl-join-error {
    color: #b32d2e;
    margin-top: 10px;
    font-size: 13px;
}

/* ---- Boutons ---- */

.phl-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.phl-btn:hover { transform: translateY(-1px); }

.phl-btn-session {
    background: #00a32a;
    color: #fff;
    font-size: 12px;
    padding: 8px 14px;
    white-space: nowrap;
}
.phl-btn-session:hover { background: #008a20; }

.phl-btn-leave {
    background: #b32d2e;
    color: #fff;
    font-size: 13px;
    padding: 8px 16px;
}
.phl-btn-leave:hover { background: #8b2020; }

/* ---- Picker / Accordéon ---- */

.phl-picker-wrapper {
    max-width: 960px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.phl-picker-title {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: #1d1d1f;
}

.phl-accordion-item { margin-bottom: 16px; }

.phl-picker-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    border: 2px solid transparent;
    display: flex;
    align-items: stretch;
}

.phl-picker-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border-color: #2271b1;
}

.phl-accordion-item.phl-open > .phl-picker-card {
    border-color: #2271b1;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.phl-picker-card-img {
    width: 140px;
    min-height: 90px;
    flex-shrink: 0;
    overflow: hidden;
    background: #f0f0f1;
}

.phl-picker-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.phl-picker-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #c3c4c7;
}

.phl-picker-card-body {
    flex: 1;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.phl-picker-card-body h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; color: #1d1d1f; }
.phl-picker-card-count { font-size: 13px; color: #646970; }

.phl-picker-card-actions-front {
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex-shrink: 0;
}

.phl-picker-card-arrow {
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
}

.phl-arrow-icon { font-size: 14px; color: #646970; transition: transform 0.3s; }

.phl-accordion-content {
    background: #f9fafb;
    border: 2px solid #2271b1;
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    padding: 20px;
}

.phl-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.phl-gallery-item {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    aspect-ratio: 1;
}
.phl-gallery-item:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.phl-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- SESSION VIEW ---- */

.phl-session-header {
    max-width: 960px;
    margin: 20px auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}

.phl-session-header-left {
    flex: 1;
    min-width: 200px;
}

.phl-session-header-info h2 {
    margin: 0;
    font-size: 20px;
}

.phl-session-code {
    font-size: 14px;
    color: #646970;
    margin-top: 2px;
}

.phl-session-code strong {
    font-family: monospace;
    font-size: 18px;
    letter-spacing: 3px;
    color: #2271b1;
}

.phl-session-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.phl-session-qr img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: transform 0.15s, box-shadow 0.15s;
}

.phl-session-qr:hover img {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* QR Fullscreen */
.phl-qr-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    cursor: pointer;
}

.phl-qr-fullscreen-inner {
    text-align: center;
}

.phl-qr-fullscreen-inner img {
    width: 320px;
    height: 320px;
    border-radius: 16px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.4);
}

.phl-qr-fullscreen-code {
    margin-top: 20px;
    font-size: 24px;
    color: #fff;
}

.phl-qr-fullscreen-code strong {
    font-family: monospace;
    font-size: 32px;
    letter-spacing: 6px;
    color: #fff;
}

.phl-qr-fullscreen-hint {
    margin-top: 12px;
    font-size: 14px;
    color: rgba(255,255,255,0.5);
}

.phl-qr-label {
    font-size: 11px;
    color: #646970;
    margin-top: 4px;
    text-align: center;
}

.phl-session-participants {
    flex: 1;
    font-size: 13px;
    color: #646970;
}

.phl-participants-label {
    font-weight: 600;
    color: #1d2327;
}

.phl-participant-badge {
    display: inline-block;
    background: #f0f0f1;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px 2px;
    color: #1d2327;
}

.phl-participant-me {
    background: #2271b1;
    color: #fff;
}

/* ---- Panneau joueurs (créateur) ---- */

.phl-players-panel {
    max-width: 960px;
    margin: 16px auto;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.phl-players-panel h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1d2327;
}

.phl-players-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 16px;
    flex-wrap: wrap;
}

.phl-btn-export {
    background: #1d2327;
    color: #fff;
    font-size: 13px;
    padding: 10px 20px;
    white-space: nowrap;
}
.phl-btn-export:hover { background: #2c3338; }

.phl-players-hint {
    margin: 0 0 14px 0;
    font-size: 13px;
    color: #646970;
    font-style: italic;
}

.phl-players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.phl-player-item {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    background: #f6f7f7;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    min-width: 140px;
    transition: all 0.15s;
}

.phl-player-clickable {
    cursor: pointer;
    border-color: #2271b1;
    background: #f0f6fc;
}

.phl-player-clickable:hover {
    background: #e1edf8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.15);
}

.phl-player-me {
    border-color: #c3c4c7;
    opacity: 0.6;
}

.phl-player-name {
    font-weight: 700;
    font-size: 14px;
    color: #1d2327;
}

.phl-player-clickable .phl-player-name {
    color: #2271b1;
}

.phl-player-status {
    font-size: 12px;
    color: #646970;
    margin-top: 2px;
}

/* ---- Grille session ---- */

.phl-session-grid {
    max-width: 960px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.phl-session-img {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
}

.phl-session-img:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.phl-session-img.phl-img-has-viewers {
    border-color: #2271b1;
}

.phl-session-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.phl-session-img-indicators {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.phl-indicator-dot {
    display: inline-block;
    font-size: 14px;
    background: rgba(0,0,0,0.6);
    border-radius: 8px;
    padding: 2px 6px;
    line-height: 1;
}

.phl-indicator-me {
    background: rgba(34, 113, 177, 0.85);
}

/* ---- Fullscreen ---- */

.phl-session-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.phl-session-fullscreen.phl-fs-visible {
    opacity: 1;
}

.phl-session-fullscreen.phl-fs-locked {
    cursor: default;
    border: 4px solid #d63638;
}

.phl-session-fullscreen img {
    max-width: 92%;
    max-height: 88vh;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Badge verrouillé */
.phl-session-fs-lock-badge {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #d63638;
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    z-index: 10;
    animation: phl-pulse 2s infinite;
}

@keyframes phl-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Barre de progression du long-press */
.phl-session-fs-lock-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 8px;
    width: 0;
    background: linear-gradient(90deg, #d63638, #ff6b6b);
    z-index: 10;
    border-radius: 0 4px 0 0;
}

/* ---- Lightbox (hors session) ---- */

.phl-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s;
}
.phl-lightbox.phl-visible { opacity: 1; }
.phl-lightbox img { max-width: 90%; max-height: 85vh; border-radius: 8px; }
.phl-lightbox-close {
    position: absolute; top: 20px; right: 30px;
    background: none; border: none; color: #fff;
    font-size: 36px; cursor: pointer; opacity: 0.8;
}
.phl-lightbox-close:hover { opacity: 1; }

/* ---- Autres ---- */

.phl-container {
    max-width: 900px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.phl-title { font-size: 28px; font-weight: 700; margin-bottom: 20px; color: #1d1d1f; text-align: center; }

.phl-featured-image { text-align: center; margin-bottom: 24px; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.phl-featured-image img { width: 100%; max-width: 600px; height: auto; display: block; margin: 0 auto; }

.phl-toggle-gallery {
    display: block; margin: 20px auto; padding: 12px 28px;
    background: #2271b1; color: #fff; border: none; border-radius: 8px;
    font-size: 15px; font-weight: 600; cursor: pointer;
}
.phl-toggle-gallery:hover { background: #135e96; }
.phl-toggle-gallery.phl-open { background: #646970; }

.phl-error {
    background: #fef1f1; color: #b32d2e; padding: 14px 18px;
    border-radius: 6px; border-left: 4px solid #b32d2e;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
    .phl-picker-card { flex-direction: column; }
    .phl-picker-card-img { width: 100%; height: 120px; }
    .phl-picker-card-actions-front { padding: 8px 12px; }
    .phl-picker-card-arrow { padding: 8px; justify-content: center; }
    .phl-session-header { flex-direction: column; align-items: flex-start; }
    .phl-session-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
    .phl-join-form { flex-direction: column; }
    .phl-join-form input[type="text"], .phl-btn-join { width: 100%; max-width: none; }
    #phl-join-code { max-width: none; }
}
