/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for theming */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --surface-hover: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border: #334155;
        --border-hover: #475569;
    }
}

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.header-content {
    text-align: left;
    flex: 1;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Language Selector */
.language-selector {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.language-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.language-selector select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-selector select:hover {
    border-color: var(--border-hover);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Status Card */
.status-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--secondary-color);
    animation: pulse 2s infinite;
}

.status-indicator.connecting {
    background: var(--warning-color);
}

.status-indicator.connected {
    background: var(--success-color);
    animation: none;
}

.status-indicator.error {
    background: var(--error-color);
    animation: none;
}

/* Divider styles */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    padding: 0 1rem;
    background: var(--background-color);
}

/* Join options styling */
.join-options {
    margin-top: 1rem;
}

.join-options h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.offer-input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.offer-input-container textarea {
    min-height: 100px;
    resize: vertical;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    background: var(--card-background);
    color: var(--text-color);
}

.offer-input-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.btn-copy {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    min-width: 2rem;
}

/* Instructions Card */
.instructions-card {
    background: linear-gradient(135deg, var(--surface), var(--surface-hover));
    border: 2px solid var(--primary-color);
    margin-bottom: 2rem;
}

.instructions-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.instruction-section h4 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.instruction-section ol {
    padding-left: 1.5rem;
    color: var(--text-primary);
}

.instruction-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.security-info {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--success-color);
}

.security-info p {
    margin: 0.5rem 0;
    color: var(--success-color);
    font-weight: 500;
}

/* Main Actions */
.main-actions {
    background: linear-gradient(135deg, var(--surface), var(--surface-hover));
    border: 2px solid var(--border);
}

/* Call Options */
.call-options {
    text-align: center;
}

.call-options .btn {
    padding: 1.25rem 2rem;
    font-size: 1.2rem;
    min-width: 200px;
    margin-bottom: 1rem;
}

.btn-large {
    padding: 1.25rem 2rem;
    font-size: 1.2rem;
    min-width: 200px;
}

.call-description, .join-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Join Options */
.join-options {
    text-align: center;
}

.join-options h3 {
    margin-bottom: 1rem;
}

.join-options p {
    margin-bottom: 1rem;
}

.join-options .btn {
    padding: 1.25rem 2rem;
    font-size: 1.2rem;
    min-width: 200px;
    margin-bottom: 1rem;
}

/* Share Options */
.share-options {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.link-share {
    display: flex;
    gap: 0.75rem;
}

.link-share input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.875rem;
}

/* Short Link Section */
.short-link-section {
    margin-top: 1rem;
}

.short-link-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.short-link-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.short-link-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.875rem;
}

.short-link-info {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.short-link-info small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--success-color);
}

/* Call Link Info */
.call-link-info, .response-link-info, .response-code-info {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.call-link-info small, .response-link-info small, .response-code-info small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--success-color);
}

/* Short Code Section - special styling for response codes */
.short-code-section {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--surface-hover);
    border-radius: var(--radius);
    border: 2px dashed var(--primary-color);
}

.short-code-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.short-code-container input {
    flex: 1;
    padding: 0.75rem;
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    text-align: center;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 1.2em;
}

.short-code-container input:focus {
    outline: none;
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 3px rgb(79 70 229 / 0.1);
}

/* Call Ready Section */
.call-ready {
    text-align: center;
    padding: 2rem 0;
    background: var(--surface-hover);
    border: 1px solid var(--success-color);
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.success-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.call-ready h4 {
    color: var(--success-color);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.call-ready p {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.next-steps {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem;
    text-align: left;
}

.next-steps p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Call Status Section */
.call-status {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface-hover);
    border: 1px solid var(--success-color);
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.status-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.call-status p {
    margin: 0.5rem 0;
}

.call-status strong {
    color: var(--success-color);
}

/* Response Input Section */
.response-input-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.response-input-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.response-input-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
}

.response-input-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.response-input-info {
    margin: 0;
    text-align: center;
}

.response-input-info small {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Answer Input Section */
.answer-input-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
}

.answer-input-section p {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.answer-input-container {
    display: flex;
    gap: 0.75rem;
}

.answer-input-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
}

.answer-input-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Join Options */
.join-options {
    display: flex;
    gap: 0.75rem;
}

.join-options input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
}

/* Media Options */
.media-options {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

/* Toggle Switch */
.toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle input {
    display: none;
}

.slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--border);
    border-radius: 24px;
    transition: all 0.2s ease;
}

.slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.toggle input:checked + .slider {
    background: var(--primary-color);
}

.toggle input:checked + .slider::before {
    transform: translateX(26px);
}

.toggle .label {
    font-weight: 500;
}

/* Video Container */
.video-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mirror local video for natural appearance */
#localVideo {
    transform: scaleX(-1);
}

.video-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.video-controls {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.control-btn.disabled {
    background: rgba(239, 68, 68, 0.8);
}

/* Chat Section */
.chat-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border);
    margin: -1.5rem -1.5rem 1rem -1.5rem;
}

.chat-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-messages {
    height: 350px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    max-width: 75%;
    word-wrap: break-word;
    position: relative;
    box-shadow: var(--shadow);
    animation: messageSlide 0.3s ease-out;
}

.message.sent {
    background: var(--primary-color);
    color: white;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 0.25rem;
}

.message.sent::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--primary-color);
    border-bottom: 8px solid transparent;
}

.message.received {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}

.message.received::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--surface);
    border-bottom: 8px solid transparent;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    font-weight: 400;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message.received .message-time {
    color: var(--text-secondary);
}

.chat-input {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface-hover);
    border-top: 1px solid var(--border);
    margin: 1rem -1.5rem -1.5rem -1.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 2rem;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.chat-input button {
    border-radius: 2rem;
    padding: 0.875rem 1.5rem;
}

/* File Transfer */
.file-send, .file-receive {
    margin-bottom: 1.5rem;
}

.file-send {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

progress {
    flex: 1;
    height: 8px;
    border: none;
    border-radius: 4px;
    background: var(--border);
}

progress::-webkit-progress-bar {
    background: var(--border);
    border-radius: 4px;
}

progress::-webkit-progress-value {
    background: var(--primary-color);
    border-radius: 4px;
}

progress::-moz-progress-bar {
    background: var(--primary-color);
    border-radius: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--surface-hover);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.file-info {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Connection Info */
.info-grid {
    display: grid;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Answer Modal */
.answer-modal .modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.answer-modal .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-modal .modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.answer-modal .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-modal .close-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.answer-modal .modal-body {
    padding: 1.5rem;
}

.answer-modal .link-share {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.answer-modal .link-share input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.875rem;
}

.answer-modal .short-link-section {
    margin-top: 1rem;
}

.answer-modal .short-link-section p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0 0 0.75rem 0;
}

.answer-modal .short-link-section button {
    margin-bottom: 0.75rem;
}

.answer-modal .short-link-section #answerShortLinkResult {
    display: flex;
    gap: 0.75rem;
}

.answer-modal .short-link-section #answerShortLinkResult input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.875rem;
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast.info {
    background: var(--primary-color);
}

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

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes messageSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0.5rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .header-content {
        text-align: center;
        width: 100%;
    }
    
    header h1 {
        font-size: 1.8rem;
        line-height: 1.2;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    header p {
        font-size: 1rem;
        line-height: 1.4;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    .language-selector {
        align-items: center;
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }
    
    .card {
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .instructions-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
    }
    
    .instruction-section {
        width: 100%;
        box-sizing: border-box;
    }
    
    .instruction-section ol {
        padding-left: 1.2rem;
        width: 100%;
    }
    
    .instruction-section li {
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.5;
    }
    
    .security-info {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
    
    .security-info p {
        font-size: 0.9rem;
        line-height: 1.4;
        word-wrap: break-word;
        hyphens: auto;
        margin: 0.5rem 0;
    }
    
    .video-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
    }
    
    .video-wrapper {
        aspect-ratio: 16/9;
        min-height: 200px;
        width: 100%;
    }
    
    .call-options,
    .join-options {
        width: 100%;
        box-sizing: border-box;
    }
    
    .join-options {
        text-align: left;
        display: block !important;
        width: 100% !important;
    }
    
    .join-options h3 {
        text-align: left;
        margin-bottom: 1rem;
        display: block !important;
        width: 100% !important;
        clear: both;
    }
    
    .join-options p {
        text-align: left;
        margin-bottom: 1rem;
        display: block !important;
        width: 100% !important;
        clear: both;
    }
    
    .call-options .btn,
    .btn-large {
        min-width: auto;
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        margin-bottom: 0.75rem;
        box-sizing: border-box;
    }
    
    .call-description {
        font-size: 0.9rem;
        line-height: 1.4;
        word-wrap: break-word;
        hyphens: auto;
        text-align: center;
    }
    
    .join-description {
        font-size: 0.9rem;
        line-height: 1.4;
        word-wrap: break-word;
        hyphens: auto;
        text-align: left;
    }
    
    .divider {
        margin: 2rem 0;
        text-align: center;
    }
    
    .divider span {
        font-size: 1rem;
        font-weight: 600;
        padding: 0 1rem;
    }
    
    .offer-input-container,
    .answer-input-container {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .offer-input-container textarea,
    .answer-input-container textarea {
        min-height: 120px;
        font-size: 0.875rem;
        width: 100%;
        box-sizing: border-box;
        resize: vertical;
    }
    
    .chat-messages {
        height: 200px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .message {
        max-width: 85%;
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    .chat-input {
        padding: 0.75rem;
        gap: 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chat-input input {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .file-send {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }
    
    .info-grid {
        gap: 0.5rem;
        width: 100%;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 0;
        width: 100%;
        word-wrap: break-word;
    }
    
    .info-label {
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
    
    #toastContainer {
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
    }
    
    .toast {
        max-width: none;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        word-wrap: break-word;
    }
    
    /* Fix text overflow issues */
    h1, h2, h3, h4, p, span, div {
        word-wrap: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    /* Ensure all containers respect mobile width */
    .main-actions,
    .call-created-section,
    .call-active-section,
    .video-chat-section,
    .chat-section,
    .file-transfer-section,
    .connection-info-section {
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    /* Force main actions to be vertical on mobile */
    .main-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .main-actions .call-options,
    .main-actions .divider,
    .main-actions .join-options {
        width: 100% !important;
        margin-bottom: 1.5rem;
        flex: none !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .main-actions {
            display: -webkit-flex !important;
            display: flex !important;
            -webkit-flex-direction: column !important;
            flex-direction: column !important;
            -webkit-align-items: stretch !important;
            align-items: stretch !important;
        }
        
        .join-options {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
        }
        
        .join-options h3 {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
            margin-bottom: 1rem !important;
            clear: both !important;
        }
        
        .join-options p {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
            margin-bottom: 1rem !important;
            clear: both !important;
        }
        
        .offer-input-container {
            display: -webkit-flex !important;
            display: flex !important;
            -webkit-flex-direction: column !important;
            flex-direction: column !important;
            width: 100% !important;
            gap: 1rem !important;
        }
        
        .offer-input-container textarea {
            width: 100% !important;
            margin-bottom: 1rem !important;
        }
        
        .offer-input-container button {
            width: 100% !important;
        }
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .container {
        padding: 0.25rem;
        width: 100%;
    }
    
    .card {
        padding: 0.75rem;
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    header {
        padding: 0.75rem;
        width: 100%;
    }
    
    header h1 {
        font-size: 1.6rem;
        line-height: 1.2;
    }
    
    header p {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .btn-large {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .instructions-content {
        gap: 1rem;
        width: 100%;
    }
    
    .instruction-section {
        width: 100%;
    }
    
    .instruction-section ol {
        padding-left: 1rem;
        width: 100%;
    }
    
    .instruction-section li {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
        line-height: 1.4;
        word-wrap: break-word;
    }
    
    .security-info p {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .video-wrapper {
        min-height: 180px;
        width: 100%;
    }
    
    .chat-messages {
        height: 180px;
        padding: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .message {
        font-size: 0.8rem;
        padding: 0.5rem 0.7rem;
        margin-bottom: 0.75rem;
        max-width: 90%;
    }
    
    .chat-input {
        padding: 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chat-input input {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .offer-input-container,
    .answer-input-container {
        width: 100%;
    }
    
    .offer-input-container textarea,
    .answer-input-container textarea {
        min-height: 100px;
        font-size: 0.8rem;
        padding: 0.625rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .call-description {
        font-size: 0.85rem;
        line-height: 1.3;
        text-align: center;
    }
    
    .join-description {
        font-size: 0.85rem;
        line-height: 1.3;
        text-align: left;
    }
    
    /* Additional mobile fixes for very small screens */
    .divider {
        margin: 1.5rem 0;
    }
    
    .divider span {
        font-size: 0.9rem;
        padding: 0 0.75rem;
    }
    
    .join-options {
        text-align: left;
        display: block !important;
        width: 100% !important;
    }
    
    .join-options h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
        text-align: left;
        display: block !important;
        width: 100% !important;
        clear: both;
    }
    
    .join-options p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
        text-align: left;
        display: block !important;
        width: 100% !important;
        clear: both;
    }
    
    .offer-input-container,
    .answer-input-container {
        gap: 1rem;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    
    /* Force main actions to be vertical on small mobile */
    .main-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .main-actions .call-options,
    .main-actions .divider,
    .main-actions .join-options {
        width: 100% !important;
        margin-bottom: 1.5rem;
        flex: none !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .main-actions {
            display: -webkit-flex !important;
            display: flex !important;
            -webkit-flex-direction: column !important;
            flex-direction: column !important;
            -webkit-align-items: stretch !important;
            align-items: stretch !important;
        }
        
        .join-options {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
        }
        
        .join-options h3 {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
            margin-bottom: 1rem !important;
            clear: both !important;
        }
        
        .join-options p {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
            margin-bottom: 1rem !important;
            clear: both !important;
        }
        
        .offer-input-container {
            display: -webkit-flex !important;
            display: flex !important;
            -webkit-flex-direction: column !important;
            flex-direction: column !important;
            width: 100% !important;
            gap: 1rem !important;
        }
        
        .offer-input-container textarea {
            width: 100% !important;
            margin-bottom: 1rem !important;
        }
        
        .offer-input-container button {
            width: 100% !important;
        }
    }
}
