/* Global Reset & Fonts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html,
body {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(80, 4, 126, 0.1), rgba(76, 16, 75, 0.8));
    color: #fff;
    overflow: hidden;
    position: relative;
}

a {
    color: #fff;
    text-decoration: none;
}

.hidden {
    display: none;
}

/* Animated Hearts Background */
.hearts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

.heart {
    position: absolute;
    color: rgba(255, 0, 0, 0.7);
    font-size: 2rem;
    animation: float 6s linear infinite;
}

@keyframes float {
    0% {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) scale(0.5);
        opacity: 0;
    }
}

/* Connection Popup (Before connecting) */
#connectionPopup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-out;
}

#connectionPopup .popup-content {
    background: #333;
    padding: 20px 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#connectionPopup input,
#connectionPopup button {
    margin: 10px 0;
    width: 100%;
    padding: 8px 10px;
    border-radius: 5px;
    border: none;
    font-size: 1rem;
}

#connectionPopup button {
    background: #27ae60;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

#connectionPopup button:hover {
    background: #1e8c4a;
}

/* Sidebar (Desktop only) */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 80px;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 1000;
}

#sidebar:hover {
    background: rgba(0, 0, 0, 0.6);
}

#sidebar .icon {
    font-size: 2.2rem;
    margin: 20px 0;
    cursor: pointer;
    transition: transform 0.2s;
}

#sidebar .icon:hover {
    transform: scale(1.1);
}

/* Main Layout */
#main {
    margin-left: 80px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

header {
    padding: 15px;
    text-align: center;
    position: relative;
    animation: fadeIn 0.5s ease-out;
}

header h1 {
    font-size: 2.6rem;
    margin-bottom: 5px;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Modern Logout Icon */
#logoutBtn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    transition: transform 0.2s;
}

#logoutBtn:hover {
    transform: scale(1.1);
}

/* Video Player Container */
#videoPlayerContainer {
    max-width: 800px;
    margin: 20px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: transparent;
    position: relative;
    transition: height 0.3s ease;
}

/* Collapsed video container styles */
#videoPlayerContainer.collapsed {
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    margin: 10px auto;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
}

#videoPlayerContainer.collapsed:before {
    content: 'Video is playing';
    color: white;
    position: absolute;
    left: 15px;
    font-size: 0.9rem;
}

/* Video Controls */
#videoControls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    z-index: 10;
}

#videoPlayerContainer.collapsed #videoControls {
    position: static;
    margin: 0;
    padding: 0;
}

#videoControls button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-left: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

#videoPlayerContainer.collapsed #videoControls button {
    background: rgba(255, 255, 255, 0.2);
}

#videoControls button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

#videoControls button:hover {
    background: rgba(255, 255, 255, 0.4);
}

#hideVideoBtn {
    font-family: Arial, sans-serif;
    font-weight: bold;
}

#videoControls i {
    font-style: normal;
    font-size: 16px;
}

/* Responsive Video Frame */
#videoPlayer {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Video Content - Ensure visibility */
#videoPlayer iframe,
#videoPlayer video {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    border-radius: inherit;
    display: block;
}

/* Click Protection Overlay */
#videoPlayerContainer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 3;
}

/* Chat Section (Visible only when connected) */
#chatSection {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Container (Conversation view) */
#chatContainer {
    flex: 1;
    padding: 10px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.15);
}

/* Chat Bubble Base */
.message {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Sent vs Received */
.sent {
    align-self: flex-end;
    background: rgba(39, 174, 96, 0.9);
}

.received {
    align-self: flex-start;
    background: rgba(52, 152, 219, 0.9);
}

/* System message styling */
.system {
    align-self: center;
    background: rgba(0, 0, 0, 0.5);
    max-width: 90%;
    font-style: italic;
    text-align: center;
}

/* Connection message styling - enhanced for both sides */
.connection-message {
    align-self: center;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.5), rgba(52, 152, 219, 0.5));
    padding: 8px 20px;
    border-radius: 50px;
    max-width: 90%;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    margin: 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 500;
    letter-spacing: 0.3px;
    transform: translateZ(0);
    transition: all 0.2s ease;
}

.connection-message:hover {
    transform: translateY(-1px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.connection-message .msg-time {
    position: relative;
    margin-left: 10px;
    font-size: 0.75rem;
    opacity: 0.8;
    display: inline;
    padding-top: 0;
    font-weight: normal;
}

.connection-message .msg-time:before {
    content: '•';
    position: absolute;
    left: -7px;
    opacity: 0.7;
}

.connection-message .connection-icon {
    font-size: 1rem;
    margin-right: 6px;
    position: relative;
    top: 1px;
}

/* File Message Styling */
.file-message {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.file-name {
    font-weight: bold;
}

.progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    height: 8px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #27ae60;
    transition: width 0.3s;
}

/* Limit previews to a fixed size */
.message img,
.message video {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    margin-top: 5px;
}

.msg-time {
    display: block;
    font-size: 0.8em;
    color: white;
    padding-top: 2px;
}

.date-header {
    text-align: center;
    font-weight: bold;
    margin: 10px 0;
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(123, 25, 204, 0.35);
    padding: 20px 30px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h2 {
    margin-bottom: 25px;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
    position: relative;
    display: inline-block;
}

.modal-content h2:after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, rgba(142, 68, 173, 0.7), rgba(155, 89, 182, 0.7));
    margin: 8px auto 0;
    border-radius: 3px;
}

.popup-buttons {
    margin-top: 10px;
}

.popup-buttons button {
    margin: 0 5px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background: #2c3e50;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.popup-buttons button:hover {
    background: #34495e;
    transform: translateY(-2px);
}

/* Clickable file name link styling */
.file-link {
    display: block;
    margin-top: 5px;
    color: #fff;
    text-decoration: underline;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Status Indicator */
#statusIndicator {
    position: absolute;
    top: 15px;
    right: 60px;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.5);
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#statusIndicator:empty::before {
    content: 'Offline';
    color: #e74c3c;
}

.status-online {
    color: #2ecc71;
}

.status-away {
    color: #f39c12;
}

.status-offline {
    color: #e74c3c;
}

/* Typing Indicator */
#typingIndicator {
    font-style: italic;
    font-size: 0.9rem;
    margin: 5px 15px;
    opacity: 0.8;
}

/* Input Bar */
#inputBar {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
}

#inputBar button {
    background: none;
    border: none;
    font-size: 1.5rem;
    margin-right: 10px;
    cursor: pointer;
    color: #fff;
}

#inputBar input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 1rem;
}

#inputBar button#sendMsgBtn {
    background: #27ae60;
    border-radius: 20px;
    padding: 8px 15px;
    margin-left: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

#inputBar button#sendMsgBtn:hover {
    background: #1e8c4a;
}

/* Footer */
footer {
    text-align: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    margin: 10px auto;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #ffffff;
    animation: spin 1s linear infinite;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    z-index: 3000;
    animation: fadeInOut 3s ease forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    #main {
        margin-left: 0;
    }

    header h1 {
        font-size: 2rem;
    }

    #connectionPopup .popup-content {
        padding: 15px;
    }

    #videoPlayer {
        max-width: 100%;
        height: auto;
    }
    
    .message {
        max-width: 85%;
    }
}

/* Connection Popup - Modern Design 2.0 */
.connection-id-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.connection-id-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.connection-id-header span {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.copy-options {
    display: flex;
    gap: 8px;
}

.copy-options button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.copy-options button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.copy-options .icon {
    font-style: normal;
    font-size: 14px;
}

.id-display {
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#popupMyPeerId {
    font-size: 1.6rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-align: center;
    background: rgba(0, 0, 0, 0.15);
    padding: 10px 15px;
    border-radius: 10px;
    display: inline-block;
    min-width: 200px;
}

.connection-input {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.connection-input input {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.connection-input input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.connection-input input:focus {
    outline: none;
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.connection-input button {
    padding: 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(142, 68, 173, 0.3);
    letter-spacing: 0.5px;
}

.connection-input button:hover {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(142, 68, 173, 0.4);
}

.connection-input button:active {
    transform: translateY(-1px);
}

/* Mobile Setting Icon - Moved to Left */
.mobile-icon {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 1.4rem;
    background: none;
    border: none;
    color: #6a1b9a;
}

/* Settings Popup Styling */
#settingsPopup .modal-content {
    max-width: 500px;
    padding: 25px;
    position: relative;
}

.settings-section {
    margin: 15px 0;
    text-align: left;
}

.settings-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.setting-item input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.setting-item input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

#saveSettingsBtn {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: #8e44ad;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
}

#saveSettingsBtn:hover {
    background: #9b59b6;
    transform: translateY(-2px);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

/* Settings Icon (Mobile & Desktop) */
.settings-icon {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.settings-icon:hover {
    transform: rotate(45deg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    #main {
        margin-left: 0;
    }

    header h1 {
        font-size: 2rem;
    }

    .mobile-icon {
        display: block;
    }

    #videoPlayer {
        max-width: 100%;
        height: auto;
    }
    
    .message {
        max-width: 85%;
    }

    .modal-content {
        width: 95%;
        padding: 15px;
    }

    #popupMyPeerId {
        font-size: 1.3rem;
    }
} 