/**
 * Church Ministry Mandate - Mobile-First Responsive Stylesheet
 * Optimized for all devices with proper mobile, tablet, and desktop layouts
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow-x: hidden;
}

html {
    height: 100%;
}

/* Mobile-First Header Styles */
.header {
    background-color: #fff;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    height: 30px;
}

/* Mobile Navigation */
.nav-tabs {
    display: flex;
    gap: 15px;
    list-style: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tabs li {
    position: relative;
    flex-shrink: 0;
}

.nav-tabs a {
    text-decoration: none;
    color: #666;
    font-size: 14px;
    padding: 8px 0;
    display: block;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav-tabs a:hover,
.nav-tabs a.active {
    color: #4A90E2;
}

.nav-tabs a.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #4A90E2;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-shrink: 0;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #4A90E2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
}

.user-name {
    font-weight: 500;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    display: none; /* Hidden on mobile by default */
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a:hover {
    background: #f8f9fa;
}

.user-dropdown a:first-child {
    border-radius: 8px 8px 0 0;
}

.user-dropdown a:last-child {
    border-radius: 0 0 8px 8px;
}

/* Mobile-First Main Title */
.main-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin: 15px 0;
    color: #000;
    padding: 0 15px;
}

/* Mobile-First Container */
.container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 15px 15px;
    height: calc(100vh - 140px);
    overflow: hidden;
}

/* Mobile Participants Panel */
.participants-panel {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    max-height: 200px;
    order: 3;
}

.participants-header {
    background: linear-gradient(135deg, #A8D5FF 0%, #6BB6FF 100%);
    color: #000;
    padding: 12px 15px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participants-header::after {
    content: '▼';
    font-size: 12px;
    transition: transform 0.3s;
}

.participants-panel.collapsed .participants-header::after {
    transform: rotate(-90deg);
}

.participants-list {
    height: 150px;
    overflow-y: auto;
    padding: 10px;
    transition: max-height 0.3s ease;
}

.participants-panel.collapsed .participants-list {
    display: none;
}

.participant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.participant-item:hover {
    background-color: #f8f9fa;
}

.participant-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
}

.participant-info {
    flex: 1;
    min-width: 0;
}

.participant-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-zone {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile-First Video Section */
.video-section {
    flex: 1;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    order: 1;
    min-height: 250px;
}

.video-header {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.video-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.live-badge {
    display: inline-block;
    background-color: #ff0000;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
}

.video-container {
    position: relative;
    width: 100%;
    flex: 1;
    background-color: #000;
    min-height: 200px;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Video.js player styling */
.video-js {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-js .vjs-big-play-button {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    padding: 20px;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    transition: opacity 0.2s;
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    opacity: 0.7;
}

.live-indicator {
    background-color: #ff0000;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

/* Mobile Chat Panel */
.chat-panel {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 300px;
    order: 2;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.message-author {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.message-zone {
    font-size: 10px;
    color: #666;
}

.message-text {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-input-container {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #4A90E2;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4A90E2;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: #357ABD;
}

/* Mobile Bottom Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #eee;
    padding: 10px;
    z-index: 1000;
}

.mobile-nav-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.mobile-nav-btn {
    flex: 1;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-nav-btn.active {
    background: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

/* Scrollbar Styles */
.participants-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.participants-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.participants-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.participants-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Tablet Styles (768px and up) */
@media (min-width: 768px) {
    .header {
        padding: 15px 25px;
    }
    
    .logo {
        height: 35px;
    }
    
    .nav-tabs {
        gap: 20px;
    }
    
    .nav-tabs a {
        font-size: 15px;
        padding: 10px 0;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .user-name {
        display: block;
        font-size: 15px;
    }
    
    .main-title {
        font-size: 32px;
        margin: 20px 0;
    }
    
    .container {
        padding: 0 25px 25px;
        gap: 20px;
        height: calc(100vh - 160px);
    }
    
    .participants-panel {
        max-height: 300px;
    }
    
    .participants-list {
        height: 250px;
    }
    
    .video-section {
        min-height: 350px;
    }
    
    .video-title {
        font-size: 18px;
    }
    
    .chat-panel {
        height: 400px;
    }
    
    .participant-avatar,
    .message-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .participant-name {
        font-size: 14px;
    }
    
    .participant-zone {
        font-size: 11px;
    }
    
    .message-author {
        font-size: 14px;
    }
    
    .message-zone {
        font-size: 11px;
    }
    
    .message-text {
        font-size: 14px;
    }
}

/* Desktop Styles (1024px and up) */
@media (min-width: 1024px) {
    .header {
        padding: 15px 30px;
    }
    
    .logo {
        height: 40px;
    }
    
    .nav-tabs {
        gap: 30px;
    }
    
    .nav-tabs a {
        font-size: 16px;
    }
    
    .main-title {
        font-size: 42px;
        margin: 30px 0;
    }
    
    .container {
        flex-direction: row;
        max-width: 1600px;
        margin: 0 auto;
        height: calc(100vh - 200px);
    }
    
    .participants-panel {
        width: 280px;
        max-height: none;
        height: 100%;
        order: 1;
    }
    
    .participants-header::after {
        display: none;
    }
    
    .participants-list {
        height: calc(100% - 50px);
    }
    
    .video-section {
        flex: 1;
        order: 2;
        min-height: auto;
    }
    
    .chat-panel {
        width: 320px;
        height: 100%;
        order: 3;
    }
    
    .video-container {
        min-height: auto;
    }
}

/* Large Desktop Styles (1440px and up) */
@media (min-width: 1440px) {
    .participants-panel {
        width: 320px;
    }
    
    .chat-panel {
        width: 360px;
    }
    
    .video-title {
        font-size: 20px;
    }
}

/* Landscape Mobile Styles */
@media (max-width: 767px) and (orientation: landscape) {
    .container {
        flex-direction: row;
        height: calc(100vh - 120px);
    }
    
    .participants-panel {
        width: 200px;
        max-height: none;
        height: 100%;
        order: 1;
    }
    
    .video-section {
        flex: 1;
        order: 2;
        min-height: auto;
    }
    
    .chat-panel {
        width: 250px;
        height: 100%;
        order: 3;
    }
    
    .main-title {
        font-size: 20px;
        margin: 10px 0;
    }
    
    .participants-list {
        height: calc(100% - 45px);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .control-btn,
    .send-btn {
        transform: translateZ(0);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .header,
    .participants-panel,
    .video-section,
    .chat-panel {
        background-color: #2d2d2d;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    
    .nav-tabs a {
        color: #b0b0b0;
    }
    
    .nav-tabs a:hover,
    .nav-tabs a.active {
        color: #4A90E2;
    }
    
    .user-name {
        color: #e0e0e0;
    }
    
    .main-title {
        color: #e0e0e0;
    }
    
    .participant-name,
    .message-author {
        color: #e0e0e0;
    }
    
    .participant-zone,
    .message-zone {
        color: #888;
    }
    
    .message-text {
        color: #d0d0d0;
    }
    
    .chat-input {
        background-color: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .chat-input:focus {
        border-color: #4A90E2;
    }
    
    .video-header {
        border-bottom-color: #444;
    }
    
    .chat-input-container {
        border-top-color: #444;
    }
}

/* Print Styles */
@media print {
    .header,
    .participants-panel,
    .chat-panel,
    .video-controls {
        display: none;
    }
    
    .container {
        flex-direction: column;
        height: auto;
    }
    
    .video-section {
        width: 100%;
        height: 400px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Keyboard Navigation */
.nav-tabs a:focus,
.control-btn:focus,
.send-btn:focus,
.chat-input:focus,
.user-profile:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4A90E2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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