/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #2563eb;
    --primary-green: #059669;
    --primary-teal: #14b8a6;
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e0f2fe;
    --card-bg: rgba(255, 255, 255, 0.8);
    --border-color: rgba(226, 232, 240, 0.8);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(to br, var(--bg-gradient-start), var(--bg-gradient-end));
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #2563eb, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.divider {
    max-width: 32rem;
    height: 2px;
    background: linear-gradient(to right, transparent, #3b82f6, #7c3aed, #3b82f6, transparent);
    margin: 1rem auto;
    opacity: 0.6;
}

/* Feature Tabs */
.feature-tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}

.feature-tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.feature-tab:hover {
    background: rgba(241, 245, 249, 0.8);
}

.feature-tab.active {
    background: linear-gradient(135deg, var(--primary-blue), #0ea5e9);
    color: white;
    box-shadow: var(--shadow-md);
}

.tab-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.mode-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Feature Content */
.feature-content {
    display: none;
}

.feature-content.active {
    display: block;
    animation: fadeInUp 0.6s ease-out;
}

/* Mode Switch */
.mode-switch {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.mode-btn {
    padding: 0.75rem 2rem;
    border: none;
    background: white;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-blue), #0ea5e9);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Card */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.function-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.function-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.title-icon.bg-blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.title-icon.bg-green {
    background: linear-gradient(135deg, #059669, #14b8a6);
}

.title-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
    color: white;
}

.function-title h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.function-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.connection-status-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    min-width: 8rem;
}

.connection-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: right;
    line-height: 1.35;
    padding-top: 0.15rem;
    border-top: 1px dashed var(--border-color);
}

.header-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.status-dot.status-connected {
    background: #10b981;
    animation: pulse 2s infinite;
}

.status-dot.status-syncing {
    background: #3b82f6;
    animation: pulse 2s infinite;
}

.status-dot.status-waiting {
    background: #f59e0b;
    animation: pulse 2s infinite;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.5);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-blue);
    background: rgba(37, 99, 235, 0.05);
    transform: scale(1.02);
}

.upload-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    color: #64748b;
    transition: color 0.3s;
}

.upload-area:hover .upload-icon svg,
.upload-area.dragover .upload-icon svg {
    color: var(--primary-blue);
}

.upload-area h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.link-text {
    color: var(--primary-blue);
    font-weight: 600;
    text-decoration: underline;
}

.hint {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.file-item {
    background: linear-gradient(to right, rgba(248, 250, 252, 1), rgba(219, 234, 254, 0.5));
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.2s;
    animation: slideIn 0.3s ease-out;
}

.file-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.file-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.file-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: white;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.file-status.downloading {
    color: #f59e0b;
}

.file-status.completed {
    color: #10b981;
}

.file-transfer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.transfer-speed,
.transfer-time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.transfer-speed {
    color: #3b82f6;
}

.transfer-time {
    color: var(--text-muted);
}

.icon-sm {
    width: 0.875rem;
    height: 0.875rem;
}

/* Progress Bar */
.progress-bar {
    height: 0.5rem;
    background: #e2e8f0;
    border-radius: 0.25rem;
    overflow: hidden;
    margin-top: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fb923c);
    transition: width 0.3s ease;
    border-radius: 0.25rem;
}

.progress-fill.completed {
    background: linear-gradient(90deg, #10b981, #14b8a6);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), #0ea5e9);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8, #0284c7);
}

.btn-success {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-teal));
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857, #0d9488);
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #ea580c);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #fb923c);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* Pickup Code Input */
.pickup-input-container {
    margin: 2rem 0;
}

.pickup-input {
    width: 100%;
    text-align: center;
    font-size: 2rem;
    letter-spacing: 0.5rem;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    text-transform: uppercase;
}

.pickup-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.input-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #cbd5e1;
    transition: background 0.3s;
}

.indicator.filled {
    background: var(--primary-green);
}

.input-counter {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Pickup Code Display */
.room-info {
    margin-top: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.room-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.room-info > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.pickup-code-display {
    background: linear-gradient(135deg, #f8fafc, #e0f2fe);
    border: 2px solid var(--primary-blue);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.code-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.pickup-code {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: 0.5rem;
    font-family: 'Courier New', monospace;
}

.qr-container {
    margin: 1.5rem 0;
}

.qr-container > div {
    display: inline-block;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
}

.qr-container p {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.room-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Text Editor */
.text-editor {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.editor-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.editor-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
}

.char-count {
    color: var(--text-muted);
}

.sync-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 999px;
    font-weight: 600;
}

.text-editor textarea {
    width: 100%;
    min-height: 10rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.3s;
}

.text-editor textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.text-editor textarea:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
}

.typing-indicator {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Text Display (Receiver) */
.text-display {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
}

.display-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.display-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.text-content {
    min-height: 12rem;
    padding: 1rem;
    position: relative;
}

.text-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    color: var(--text-primary);
    line-height: 1.6;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 1rem;
}

.empty-icon {
    width: 3rem;
    height: 3rem;
    color: #cbd5e1;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.typing-dots .dot {
    width: 0.375rem;
    height: 0.375rem;
    background: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* Images Container */
.images-container {
    margin-top: 1.5rem;
}

.images-container h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.image-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: white;
    padding: 0.5rem;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hint Box */
.hint-box {
    padding: 1rem;
    background: linear-gradient(to right, #dbeafe, #e0e7ff);
    border: 1px solid #93c5fd;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
}

.hint-box p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

/* Waiting Animation */
.waiting-animation {
    text-align: center;
    padding: 3rem;
}

.bounce-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.bounce-dots .dot {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--primary-blue);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.bounce-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.bounce-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.waiting-animation p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Create Room Prompt */
.create-room-prompt {
    text-align: center;
    padding: 3rem 1.5rem;
}

.prompt-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary-blue);
}

.create-room-prompt h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.create-room-prompt p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: var(--shadow-xl);
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}

.modal-close {
    position: absolute;
    top: -1rem;
    right: -1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: white;
    color: var(--text-primary);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}

.modal-close:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 0.75rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .feature-tab {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .mode-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .pickup-code {
        font-size: 1.75rem;
        letter-spacing: 0.25rem;
    }

    .pickup-input {
        font-size: 1.5rem;
        letter-spacing: 0.25rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }

    .file-item-header {
        flex-direction: column;
        align-items: stretch;
    }

    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop Sharing Styles */
.title-icon.bg-purple {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.desktop-preview {
    position: relative;
    background: #000;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    aspect-ratio: 16/9;
}

.desktop-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.preview-info {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.preview-info span {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

.quality-settings {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.setting-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.quality-select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quality-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.desktop-viewer {
    position: relative;
    background: #000;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    aspect-ratio: 16/9;
}

.desktop-viewer video,
.desktop-viewer canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-connection-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.85);
    color: #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    display: grid;
    gap: 0.35rem;
    min-width: 180px;
}

.header-connection-panel .connection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.header-connection-panel .connection-label {
    color: #cbd5e1;
    font-weight: 600;
}

.header-connection-panel .connection-value {
    font-weight: 700;
    color: #f8fafc;
}

.viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.viewer-info {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.viewer-info span {
    background: rgba(0, 0, 0, 0.6);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

.viewer-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    pointer-events: auto;
}

.peer-status {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

    pointer-events: auto;
}

.control-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.control-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Fullscreen styles */
.desktop-viewer:fullscreen {
    aspect-ratio: unset;
}

.desktop-viewer:fullscreen canvas {
    width: 100vw;
    height: 100vh;
}

.desktop-viewer:-webkit-full-screen {
    aspect-ratio: unset;
}

.desktop-viewer:-webkit-full-screen canvas {
    width: 100vw;
    height: 100vh;
}

.desktop-viewer:-moz-full-screen {
    aspect-ratio: unset;
}

.desktop-viewer:-moz-full-screen canvas {
    width: 100vw;
    height: 100vh;
}

.desktop-viewer:-ms-fullscreen {
    aspect-ratio: unset;
}

.desktop-viewer:-ms-fullscreen canvas {
    width: 100vw;
    height: 100vh;
}

/* Responsive adjustments for desktop sharing */
@media (max-width: 640px) {
    .quality-settings {
        flex-direction: column;
    }

    .setting-group {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-info,
    .viewer-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .chat-layout {
        flex-direction: column;
    }
}

/* Chat Layout Styles */
.chat-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chat-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
}

.chat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-textarea {
    width: 100%;
    min-height: 12rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.3s;
    background: white;
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-textarea[readonly] {
    background: #f8fafc;
    cursor: default;
}

.chat-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.chat-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chat-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.chat-image:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}
