/* ======================
   Admin Live Page
   ====================== */

/* Page Container - same pattern as admin-collections */
.main-content.admin-live-page {
    padding: var(--space-6);
    max-width: 100% !important;
    width: 100% !important;
}

.main-content.admin-live-page > * {
    max-width: 1000px !important;
    width: 100% !important;
    margin-left: auto;
    margin-right: auto;
}

.admin-live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.admin-live-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
}

.admin-live-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: var(--space-4);
    color: var(--text-secondary);
}

.admin-live-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: var(--space-8) 0;
}

/* ========================
   Guide / Marche à suivre
   ======================== */

.admin-live-guide {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.admin-live-guide h2 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}

.guide-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

.guide-step-content {
    flex: 1;
    padding-top: var(--space-1);
}

.guide-step-content strong {
    display: block;
    color: var(--text-primary);
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
}

.guide-step-content p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin: 0;
}

.guide-step-content a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.guide-step-content a:hover {
    border-bottom-color: var(--accent-primary);
}

.guide-step-content a::after {
    content: '\2197';
    font-size: 0.8em;
}

/* Form */

.admin-live-form-container {
    margin-bottom: var(--space-6);
}

.admin-live-form {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.admin-live-form h3 {
    margin-bottom: var(--space-4);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.admin-live-form .form-group {
    margin-bottom: var(--space-4);
}

.admin-live-form label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.admin-live-form .form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: inherit;
}

.admin-live-form .form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.admin-live-form textarea.form-input {
    resize: vertical;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: 4px;
}

.start-live-steps {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.start-live-steps .step-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}

.start-live-steps .step-item:last-child {
    margin-bottom: 0;
}

.start-live-steps .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.start-live-steps a {
    color: var(--accent-primary);
    text-decoration: underline;
    font-weight: 500;
}

.live-vimeo-link {
    font-size: var(--text-xs);
    color: var(--accent-primary);
    margin-top: var(--space-1);
    word-break: break-all;
}

.broadcast-no-player {
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    color: var(--text-secondary);
}

.admin-live-form .form-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* Stream Cards */

.admin-live-list {
    margin-top: var(--space-6);
}

.admin-live-list h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.admin-live-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-3);
    transition: border-color var(--duration-normal) var(--ease-default);
}

.admin-live-card:hover {
    border-color: var(--accent-primary);
}

.admin-live-card-info h3 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--space-1) 0;
}

.admin-live-card-info .live-date {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.admin-live-card-info .live-desc {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.admin-live-card-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Status badges */

.live-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-status-scheduled {
    background: var(--info-soft);
    color: var(--info);
}

.live-status-live {
    background: var(--danger-soft);
    color: var(--danger);
    animation: live-pulse 1.5s ease-in-out infinite;
}

.live-status-ended {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-tertiary);
}

.live-status-cancelled {
    background: var(--warning-soft);
    color: var(--warning);
}

/* Buttons */

.btn-sm {
    padding: 6px 14px;
    font-size: var(--text-xs);
}

.btn-success {
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
}

.btn-success:hover {
    opacity: 0.85;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
}

.btn-danger:hover {
    opacity: 0.85;
}

/* ========================
   Broadcast Zone (Jitsi Meet)
   ======================== */

.broadcast-container {
    margin-bottom: var(--space-6);
}

.broadcast-info-bar {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.broadcast-info-bar h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.broadcast-live-badge {
    background: var(--danger);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 1px;
    animation: live-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

/* Join button area */

.broadcast-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    margin-bottom: var(--space-6);
}

.broadcast-actions .btn-lg {
    font-size: var(--text-base);
    padding: 14px 28px;
    display: inline-flex;
    align-items: center;
}

/* Chat (admin side) */

.broadcast-chat {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

.broadcast-chat h3 {
    padding: var(--space-4);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
}

.broadcast-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.chat-msg {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    position: relative;
    font-size: var(--text-sm);
    line-height: 1.4;
}

.chat-msg:hover {
    background: var(--bg-card-hover);
}

.chat-msg-name {
    font-weight: 600;
    color: var(--accent-primary);
    margin-right: 6px;
}

.chat-msg-time {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-right: 6px;
}

.chat-msg-text {
    color: var(--text-primary);
}

.chat-msg-delete {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.chat-msg:hover .chat-msg-delete {
    opacity: 1;
}

.chat-msg-delete:hover {
    color: var(--danger);
}

/* Pulse animation */

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

/* Responsive */

@media (max-width: 768px) {
    .main-content.admin-live-page {
        padding: var(--space-4);
    }

    .admin-live-header {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
    }

    .admin-live-card {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .admin-live-card-actions {
        width: 100%;
    }

    .broadcast-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .broadcast-chat {
        max-height: 300px;
    }

    .guide-step {
        gap: var(--space-3);
    }
}

/* ========================
   Notice d'utilisation
   ======================== */

.admin-live-header-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.guide-more {
    margin: var(--space-4) 0 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.guide-more a {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
}

.guide-more a:hover {
    text-decoration: underline;
}

.admin-live-notice {
    background: var(--bg-card);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.notice-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.notice-header h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.notice-intro {
    color: var(--text-secondary);
    font-size: var(--text-base);
    line-height: 1.7;
    margin: 0 0 var(--space-5);
}

.notice-section {
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-default);
}

.notice-section h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--accent-primary);
    margin: 0 0 var(--space-3);
}

.notice-section ol,
.notice-section ul {
    margin: 0 0 var(--space-3);
    padding-left: var(--space-6);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.7;
}

.notice-section li {
    margin-bottom: var(--space-2);
}

.notice-section strong,
.notice-intro strong {
    color: var(--text-primary);
}

.notice-tip {
    background: var(--bg-secondary, rgba(255,255,255,0.04));
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin: var(--space-2) 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.notice-faq {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    line-height: 1.6;
}

.notice-faq th,
.notice-faq td {
    text-align: left;
    vertical-align: top;
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.notice-faq th {
    color: var(--text-primary);
    font-weight: 700;
}

.notice-faq td:first-child {
    width: 40%;
    color: var(--text-primary);
}

.notice-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-default);
}

@media (max-width: 640px) {
    .notice-faq td:first-child { width: auto; }
    .notice-header { flex-direction: column; }
}

@media print {
    .sidebar, .admin-live-header, .admin-live-guide, .admin-live-form-container,
    .broadcast-container, .admin-live-list, .notice-footer, .notice-header button {
        display: none !important;
    }
    .admin-live-notice {
        display: block !important;
        border: none;
        color: #000;
    }
    .admin-live-notice * { color: #000 !important; background: none !important; }
}

/* Access badges */

.live-access {
    display: inline-block;
    margin-left: var(--space-2);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.live-access-all { color: var(--success, #22c55e); border-color: var(--success, #22c55e); }
.live-access-premium { color: var(--accent-primary); border-color: var(--accent-primary); }
.live-access-sciences { color: var(--info); border-color: var(--info); }
.live-access-arabic { color: var(--warning); border-color: var(--warning); }

.admin-live-form select.form-input {
    appearance: auto;
    cursor: pointer;
}

.admin-live-form .form-hint {
    margin: var(--space-2) 0 0;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: 1.5;
}

.live-provider {
    margin: var(--space-1) 0 0;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}
