/* WebRTC Dashboard Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-header p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.user-info {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.user-info input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

.user-info input:focus {
    outline: none;
    border-color: #667eea;
}

/* Main Dashboard */
.dashboard-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Room Creation */
.room-creation {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.room-creation h2 {
    margin-bottom: 20px;
    color: #333;
}

.create-room-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.create-room-form input,
.create-room-form textarea,
.create-room-form select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.create-room-form input:focus,
.create-room-form textarea:focus,
.create-room-form select:focus {
    outline: none;
    border-color: #667eea;
}

.create-room-form textarea {
    resize: vertical;
    min-height: 80px;
}

.room-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

/* Available Rooms */
.available-rooms {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #333;
}

.room-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.room-controls input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.room-card {
    background: white;
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.room-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.room-card h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 1.1rem;
}

.room-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.room-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.room-participants {
    display: flex;
    align-items: center;
    gap: 4px;
}

.no-rooms-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Chat Room View */
.chat-room-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.chat-room-view.hidden {
    display: none;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-info h2 {
    margin-bottom: 4px;
}

.room-info span {
    font-size: 14px;
    opacity: 0.9;
}

.room-actions {
    display: flex;
    gap: 10px;
}

.chat-content {
    flex: 1;
    display: grid;
    grid-template-columns: 250px 1fr;
    overflow: hidden;
}

/* Participants Panel */
.participants-panel {
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
}

.participants-panel h3 {
    margin-bottom: 15px;
    color: #333;
}

.participants-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.participant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
}

.participant-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.participant-status.host {
    background: #ffc107;
}

.participant-name {
    flex: 1;
}

.host-badge {
    background: #ffc107;
    color: #333;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
}

/* Host Controls */
.host-controls {
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.host-controls h4 {
    margin-bottom: 15px;
    color: #333;
}

.pending-requests h5 {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
}

.requests-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.request-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
}

.request-info {
    margin-bottom: 8px;
}

.request-name {
    font-weight: bold;
    color: #333;
}

.request-message {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

.request-actions {
    display: flex;
    gap: 8px;
}

.request-actions button {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.approve-btn {
    background: #28a745;
    color: white;
}

.reject-btn {
    background: #dc3545;
    color: white;
}

.no-requests {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.message-author {
    font-weight: bold;
    color: #333;
}

.message-time {
    color: #999;
}

.message-content {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 70%;
    word-wrap: break-word;
}

.message-item.own .message-content {
    background: #667eea;
    color: white;
    align-self: flex-end;
}

.message-item.system .message-content {
    background: #ffc107;
    color: #333;
    align-self: center;
    text-align: center;
    font-style: italic;
}

.chat-input-area {
    border-top: 1px solid #ddd;
    padding: 15px 20px;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.chat-input-area input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

button:hover {
    opacity: 0.9;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 15px;
    color: #666;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
    font-family: inherit;
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.link-container input {
    flex: 1;
    margin-bottom: 0;
}

.link-options {
    margin-top: 15px;
}

.link-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.transfer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.transfer-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.transfer-option:hover {
    border-color: #667eea;
}

.transfer-option.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.transfer-option input[type="radio"] {
    margin: 0;
}

/* Status Bar */
.status-bar {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.connection-status,
.room-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc3545;
}

.status-indicator.online {
    background: #28a745;
}

.status-indicator.connecting {
    background: #ffc107;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.host-only {
    display: none;
}

.host-only.show {
    display: block;
}

.host-only.show.flex {
    display: flex;
}

/* Pending Requests Section in Sidebar */
.pending-requests-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.pending-requests-section .section-header {
    margin-bottom: 12px;
}

.pending-requests-section h4 {
    color: #3b82f6;
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Join Request Cards */
.join-request-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    color: white;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.request-info {
    margin-bottom: 12px;
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.request-info strong {
    font-size: 15px;
    color: white;
}

.request-badge {
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.request-message {
    margin: 8px 0;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-style: italic;
}

.request-time {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
}

.request-actions {
    display: flex;
    gap: 8px;
}

.approve-btn, .reject-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.approve-btn {
    background: #10b981;
    color: white;
}

.approve-btn:hover {
    background: #059669;
}

.reject-btn {
    background: #ef4444;
    color: white;
}

.reject-btn:hover {
    background: #dc2626;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-main {
        grid-template-columns: 1fr;
    }
    
    .chat-content {
        grid-template-columns: 1fr;
    }
    
    .participants-panel {
        display: none;
    }
    
    .room-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .room-controls input {
        min-width: auto;
    }
    
    .user-info {
        flex-direction: column;
    }
    
    .user-info input {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .dashboard-header {
        padding: 15px;
    }
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
    
    .room-creation,
    .available-rooms {
        padding: 15px;
    }
    
    .rooms-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    /* Fix iOS Safari input zoom */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* Better touch targets */
    button {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    /* Fix chat on mobile */
    .chat-view {
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
    }
    
    .chat-messages {
        height: calc(100vh - 250px);
        max-height: calc(100vh - 250px);
    }
    
    /* Show participants as overlay on mobile */
    .participants-panel {
        position: fixed;
        right: -300px;
        top: 0;
        height: 100vh;
        width: 280px;
        background: white;
        box-shadow: -2px 0 10px rgba(0,0,0,0.2);
        transition: right 0.3s ease;
        z-index: 1000;
    }
    
    .participants-panel.mobile-open {
        right: 0;
    }
    
    /* Mobile menu toggle */
    .mobile-participants-toggle {
        display: block;
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(45deg, #667eea, #764ba2);
        color: white;
        border: none;
        font-size: 24px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        cursor: pointer;
        z-index: 999;
    }
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    body {
        /* Fix for Safari's bottom bar */
        min-height: -webkit-fill-available;
    }
    
    .dashboard-container {
        min-height: -webkit-fill-available;
    }
    
    /* Fix input appearance */
    input, textarea, select {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
    
    /* Fix button appearance */
    button {
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Prevent zoom on input focus */
    input:focus, textarea:focus, select:focus {
        font-size: 16px;
    }
    
    /* Fix for iOS Safari scroll */
    .chat-messages {
        -webkit-overflow-scrolling: touch;
    }
}

/* Landscape mode on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-messages {
        height: calc(100vh - 200px);
    }
    
    .dashboard-header {
        padding: 10px;
    }
    
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .dashboard-container {
        max-width: 100%;
        padding: 15px;
    }
    
    .chat-content {
        grid-template-columns: 1fr 280px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}
