/* Global Styles - Mobile First */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 100%;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.6em;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Status Styles - Mobile Optimized */
.status {
    padding: 12px 15px;
    border-radius: 12px;
    margin: 15px 0 0 0;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.success { 
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724; 
    border-left: 4px solid #28a745;
}

.error { 
    background: linear-gradient(135deg, #f8d7da, #f1b0b7);
    color: #721c24; 
    border-left: 4px solid #dc3545;
}

.info { 
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460; 
    border-left: 4px solid #17a2b8;
}

.warning { 
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404; 
    border-left: 4px solid #ffc107;
}

/* Video Container - Mobile First */
.video-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.video-section {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    text-align: center;
}

.video-title {
    font-weight: 700;
    margin-bottom: 15px;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.3em;
    position: relative;
}

/* SIMPLE: Camera Swap Button with Text - No Icon Complications */
.camera-swap-btn {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
    
    /* Simple positioning */
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    
    /* Basic styling */
    outline: none;
    -webkit-tap-highlight-color: transparent;
    min-width: auto;
    min-height: 32px;
    line-height: 1;
    text-align: center;
    
    /* iOS compatibility */
    -webkit-appearance: none;
    -webkit-user-select: none;
    user-select: none;
}

.camera-swap-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6268, #495057);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.5);
}

.camera-swap-btn:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

.camera-swap-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
    transform: translateY(-50%);
}

/* Hide/Show states */
.camera-swap-btn.hidden {
    display: none;
}

.camera-swap-btn.visible {
    display: block;
}

/* Copy Button Styling */
.copy-btn {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #1565c0;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: auto;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    min-width: 32px;
    
    /* Touch improvements */
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.copy-btn:hover {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.5);
}

.copy-btn:active {
    transform: scale(0.95);
    background: rgba(33, 150, 243, 0.3);
}

/* Video Element - Mobile Optimized */
video {
    width: 100%;
    max-width: 100%;
    height: auto;
    background-color: #000;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    object-fit: cover;
}

/* Data Display Section - NEW */
.data-display {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #2196f3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.data-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.data-item:last-child {
    margin-bottom: 0;
}

.data-label {
    font-weight: 600;
    color: #1565c0;
    min-width: 120px;
    font-size: 14px;
}

.data-value {
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #333;
    border: 1px solid #e0e0e0;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    transition: all 0.2s ease;
    min-height: 20px;
    display: flex;
    align-items: center;
}

.data-value:empty::before {
    content: '-';
    color: #aaa;
}

/* Mobile-First Button Controls */
.video-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* Mobile-Optimized Buttons */
button {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    min-height: 44px;
    
    /* Better touch handling */
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-appearance: none;
}

/* Exception for camera swap button - keep its simple styling */
button.camera-swap-btn {
    padding: 8px 12px;
    font-size: 12px;
    text-transform: none;
    letter-spacing: normal;
    border-radius: 8px;
    width: auto;
    min-height: 32px;
    overflow: visible;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

button:active::before {
    left: 100%;
}

/* Don't apply shimmer effect to camera swap button */
button.camera-swap-btn::before {
    display: none;
}

.btn-success { 
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white; 
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.btn-success:hover:not(:disabled) { 
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

.btn-danger { 
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white; 
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.btn-danger:hover:not(:disabled) { 
    background: linear-gradient(135deg, #c82333, #dc2626);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6);
}

button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

/* Active button press effect */
button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Exception for camera swap button */
button.camera-swap-btn:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

/* Indicators - Enhanced for Mobile */
.indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.indicator.active { 
    background: radial-gradient(circle, #28a745, #20c997);
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.6);
}

.indicator.inactive { 
    background: radial-gradient(circle, #dc3545, #c82333);
}

.indicator.pending { 
    background: radial-gradient(circle, #ffc107, #e0a800);
    animation: pendingPulse 1.5s infinite;
}

@keyframes pulse {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.1);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

@keyframes pendingPulse {
    0% { 
        opacity: 0.5; 
        transform: scale(0.9);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1);
    }
    100% { 
        opacity: 0.5; 
        transform: scale(0.9);
    }
}

/* Session and Sharing Sections */
.sharing-section, .users-section {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.sharing-section:hover, .users-section:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sharing-section h3, .users-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.2em;
}

.share-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.share-item label {
    font-weight: 600;
    color: #6c757d;
    min-width: 80px;
}

.id-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.session-display {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    color: #0d47a1;
    border: 1px solid #dee2e6;
    flex: 1;
    min-width: 0;
    word-break: break-all;
    transition: all 0.2s ease;
}

.session-display:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #007bff;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Tablet and larger screens */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        padding: 30px;
        max-width: 500px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    .video-controls {
        flex-direction: row;
        gap: 15px;
    }
    
    button {
        font-size: 16px;
        padding: 14px 25px;
    }
    
    /* Keep camera swap button small on larger screens */
    button.camera-swap-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    video {
        border-radius: 20px;
    }
    
    .share-item {
        flex-wrap: nowrap;
    }
    
    .data-item {
        flex-wrap: nowrap;
    }
    
    .data-label {
        min-width: 140px;
    }
}

/* Large screens */
@media (min-width: 1024px) {
    .container {
        max-width: 600px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    }
    
    .container {
        background: #34495e;
        color: #ecf0f1;
    }
    
    h1 {
        color: #ecf0f1;
    }
    
    .video-section {
        background: linear-gradient(145deg, #2c3e50, #34495e);
    }
    
    .video-title {
        color: #bdc3c7;
    }
    
    .data-display {
        background: linear-gradient(135deg, #2c3e50, #34495e);
        border-left-color: #3498db;
    }
    
    .data-label {
        color: #3498db;
    }
    
    .data-value {
        background: rgba(52, 73, 94, 0.8);
        color: #ecf0f1;
        border-color: #556983;
    }
    
    .sharing-section, .users-section {
        background: linear-gradient(135deg, #2c3e50, #34495e);
        border-left-color: #3498db;
    }
    
    .session-display {
        background: rgba(52, 73, 94, 0.8);
        color: #3498db;
        border-color: #556983;
    }
    
    .user-item {
        background: rgba(52, 73, 94, 0.6);
    }
}

/* 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 */
.camera-swap-btn:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.copy-btn:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .camera-swap-btn,
    .video-controls,
    .sharing-section,
    .users-section,
    .data-display {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}