/**
 * WP Twilio Video Events - Premium Stylesheet
 * Includes layout, typography, glassmorphism, dark-mode elements, and keyframe animations.
 */

:root {
    --tve-primary: #6366f1;
    --tve-primary-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --tve-secondary: #0f172a;
    --tve-bg: #f8fafc;
    --tve-card-bg: #ffffff;
    --tve-text: #1e293b;
    --tve-text-light: #64748b;
    --tve-success: #10b981;
    --tve-danger: #ef4444;
    --tve-radius: 12px;
    --tve-glow: 0 10px 30px -10px rgba(99, 102, 241, 0.25);
    --tve-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --tve-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Global Container Styles */
.tve-events-container, .tve-single-wrapper {
    font-family: var(--tve-font);
    color: var(--tve-text);
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Header Section */
.tve-events-header {
    text-align: center;
    margin-bottom: 40px;
}
.tve-events-header h2.tve-title {
    font-family: 'Outfit', var(--tve-font);
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 10px 0;
    background: var(--tve-primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}
.tve-events-header p.tve-subtitle {
    font-size: 16px;
    color: var(--tve-text-light);
    margin: 0;
}

/* Grid Layout for Events */
.tve-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Event Cards */
.tve-event-card {
    background: var(--tve-card-bg);
    border-radius: var(--tve-radius);
    box-shadow: var(--tve-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    border: 1px solid #e2e8f0;
}
.tve-event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--tve-glow);
}

.tve-card-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}
.tve-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tve-card-placeholder {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}
.tve-card-placeholder .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
}
.tve-card-text-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 25px 25px 35px 25px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    height: 180px;
    overflow: hidden;
}
.tve-card-text-header-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #94a3b8;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

/* Badges & Status */
.tve-badge-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
}
.tve-status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.tve-badge-scheduled { background: #3b82f6; }
.tve-badge-active { background: var(--tve-danger); }
.tve-badge-completed { background: #64748b; }
.tve-badge-soon { background: #d97706; }

/* Pulse Animation for Live events */
.tve-pulse {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: tvePulseEffect 1.5s infinite;
}
@keyframes tvePulseEffect {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Card Content Details */
.tve-card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.tve-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--tve-text-light);
    margin-bottom: 15px;
}
.tve-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tve-card-meta .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
.tve-card-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.3;
}
.tve-card-title a {
    color: var(--tve-text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.tve-card-title a:hover {
    color: var(--tve-primary);
}
.tve-card-excerpt {
    font-size: 14px;
    color: var(--tve-text-light);
    line-height: 1.5;
    margin-bottom: 25px;
}

/* Action Buttons */
.tve-card-actions {
    margin-top: auto;
}
.tve-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    box-sizing: border-box;
}
.tve-btn-primary {
    background: var(--tve-primary-grad);
    color: #ffffff;
}
.tve-btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.tve-btn-secondary {
    background: #f1f5f9;
    color: var(--tve-text);
    border: 1px solid #cbd5e1;
}
.tve-btn-secondary:hover {
    background: #e2e8f0;
}
.tve-btn-outline {
    background: transparent;
    color: var(--tve-primary);
    border: 1px solid var(--tve-primary);
}
.tve-btn-outline:hover {
    background: rgba(99, 102, 241, 0.05);
}
.tve-btn-success {
    background: var(--tve-success);
    color: #ffffff;
}
.tve-btn-success:hover {
    background: #059669;
}
.tve-btn-danger {
    background: var(--tve-danger);
    color: #ffffff;
}
.tve-btn-danger:hover {
    background: #dc2626;
}

/* Tve loading spinners */
.tve-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: tveSpinner 0.8s linear infinite;
}
.tve-register-btn.tve-loading .tve-loader {
    display: inline-block;
}
.tve-register-btn.tve-loading .tve-btn-text {
    display: none;
}
@keyframes tveSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tve-registered-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #ecfdf5;
    color: var(--tve-success);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #a7f3d0;
}
.tve-banner-centered {
    width: 100%;
    margin-bottom: 20px;
}

/* Single Event Page Details Layout */
.tve-single-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}
@media (max-width: 900px) {
    .tve-single-container {
        grid-template-columns: 1fr;
    }
}

.tve-card-frame {
    background: #ffffff;
    border-radius: var(--tve-radius);
    border: 1px solid #e2e8f0;
    box-shadow: var(--tve-shadow);
    padding: 40px;
    margin-bottom: 30px;
    overflow: hidden;
}

/* Scheduled state countdown */
.tve-scheduled-card {
    text-align: center;
}
.tve-countdown-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}
.tve-countdown-block {
    background: #0f172a;
    border-radius: 10px;
    width: 70px;
    height: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}
.tve-countdown-number {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
}
.tve-countdown-label {
    font-size: 10px;
    color: var(--tve-text-light);
    text-transform: uppercase;
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.tve-time-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: var(--tve-text);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin: 10px 0 30px 0;
}
.tve-moderator-actions-panel {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}
.tve-moderator-actions-panel p {
    font-size: 13px;
    color: var(--tve-text-light);
    margin-top: 0;
}

/* Twilio Live Video Room Styling (Dark Glassmorphic UI) */
.tve-video-room {
    background: #0b0f19;
    border-radius: var(--tve-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    height: 520px;
    display: flex;
    flex-direction: column;
}
.tve-video-layout {
    display: flex;
    flex-grow: 1;
    height: calc(100% - 70px);
}
.tve-video-main {
    width: 75%;
    background: #090c15;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tve-video-main video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.tve-video-placeholder {
    text-align: center;
    color: #475569;
}
.tve-video-placeholder .dashicons {
    font-size: 80px;
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    opacity: 0.5;
}
.tve-video-placeholder p {
    font-size: 14px;
    margin: 0;
}
.tve-video-pending {
    color: #94a3b8;
    padding: 40px;
}
.tve-video-pending h3 {
    color: #f1f5f9;
    font-size: 24px;
    margin: 0 0 10px 0;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}
.tve-video-pending p {
    color: #94a3b8;
    max-width: 500px;
    margin: 0 auto;
    font-size: 14px;
    line-height: 1.5;
}

/* Participant sidebar styling */
.tve-video-sidebar {
    width: 25%;
    background: #111827;
    border-left: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tve-sidebar-title {
    margin: 15px;
    color: #f3f4f6;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tve-sidebar-grid {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 15px 15px 15px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Participant Tile inside Sidebar Grid */
.tve-participant-tile {
    background: #1f2937;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    height: 110px;
    border: 1px solid #374151;
}
.tve-tile-video {
    width: 100%;
    height: 100%;
    background: #030712;
}
.tve-tile-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tve-tile-name {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: #f3f4f6;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tve-self-tile {
    border-color: var(--tve-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* Live Room Control Dashboard Bar */
.tve-control-bar {
    height: 70px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}
.tve-control-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 25%;
}
.tve-room-status-badge {
    background: var(--tve-danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tve-room-name-display {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tve-control-center {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.tve-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.tve-control-btn:hover {
    transform: scale(1.05);
}
.tve-control-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}
.tve-btn-mute { background-color: #ef4444; } /* Red is muted by default */
.tve-btn-camera { background-color: #ef4444; }
.tve-btn-hangup { background-color: #64748b; }
.tve-btn-hangup:hover { background-color: #475569; }

.tve-control-right {
    width: 25%;
    display: flex;
    justify-content: flex-end;
}
.tve-control-right .tve-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 12px;
}

/* Room Gate details (User Registration block inside live container) */
.tve-room-gate-card, .tve-completed-card {
    text-align: center;
    padding: 60px 40px;
}
.tve-gate-icon, .tve-completed-icon {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: var(--tve-text-light);
    margin-bottom: 20px;
}
.tve-completed-icon {
    color: var(--tve-success);
}
.tve-gate-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}
.tve-gate-actions .tve-btn {
    width: auto;
    min-width: 180px;
}
.tve-moderator-recording-panel {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--tve-radius);
    padding: 30px;
    max-width: 500px;
    margin: 40px auto 0 auto;
}
.tve-moderator-recording-panel .tve-btn {
    width: auto;
}

/* Sidebar meta list */
.tve-sidebar-card {
    background: #ffffff;
    border-radius: var(--tve-radius);
    border: 1px solid #e2e8f0;
    box-shadow: var(--tve-shadow);
    padding: 30px;
}
.tve-sidebar-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}
.tve-details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tve-details-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}
.tve-details-list li:last-child {
    margin-bottom: 0;
}
.tve-details-list li > .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--tve-primary);
    margin-top: 2px;
}
.tve-details-list li strong {
    display: block;
    font-size: 13px;
    color: var(--tve-text);
}
.tve-details-list li span {
    font-size: 14px;
    color: var(--tve-text-light);
}

/* Empty listings styling */
.tve-no-events {
    background: #ffffff;
    border-radius: var(--tve-radius);
    border: 1px dashed #cbd5e1;
    text-align: center;
    padding: 60px 20px;
    color: var(--tve-text-light);
}
.tve-no-events .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}
.tve-no-events p {
    font-size: 16px;
    margin: 0;
}

/* Responsive Overrides */
@media (max-width: 767px) {
    .tve-events-grid {
        grid-template-columns: 1fr;
    }
    .tve-video-room {
        height: 400px;
    }
    .tve-video-layout {
        flex-direction: column;
    }
    .tve-video-main {
        width: 100%;
        height: 70%;
    }
    .tve-video-sidebar {
        width: 100%;
        height: 30%;
        border-left: none;
        border-top: 1px solid #1f2937;
    }
    .tve-sidebar-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding: 10px;
    }
    .tve-participant-tile {
        height: 80px;
    }
}
