/* Chat App specific styling */
.chat-app-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.connection-panel {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.connection-panel h2 {
    color: var(--text-main);
    font-size: 1.8rem;
}

.id-label {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.id-display {
    font-family: monospace;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
}

.input-group .form-control {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group .form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.status-msg {
    min-height: 20px;
    color: var(--accent-secondary);
    font-size: 0.9rem;
}

.status-msg.error {
    color: #ef4444;
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: 600px;
    padding: 0;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.system-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 1rem 0;
}

.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.msg-wrapper.sent {
    align-self: flex-end;
}

.msg-wrapper.received {
    align-self: flex-start;
}

.msg-bubble {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.sent .msg-bubble {
    background: var(--accent-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.received .msg-bubble {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.msg-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    align-self: flex-end;
}

.received .msg-time {
    align-self: flex-start;
}

.file-preview {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.file-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Chat Input */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
}

.file-attach-btn {
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.file-attach-btn:hover {
    color: var(--accent-primary);
}

.chat-input-area .form-control {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-main);
}

.chat-input-area .btn-primary {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Advanced Features UI */
.chat-header-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--accent-primary);
}

.chat-messages-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drag-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px dashed var(--accent-primary);
    border-radius: 8px;
}

.drag-drop-content {
    text-align: center;
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.drag-drop-content i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.typing-indicator {
    padding: 0.5rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    background: rgba(0, 0, 0, 0.2);
}

.typing-indicator .dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 2px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: 0s; }
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Media Container */
.media-container {
    height: 300px;
    background: #000;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#local-video {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 120px;
    height: 90px;
    background: #111;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    object-fit: cover;
    z-index: 5;
}

.end-call-btn {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
}
