@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Auth Page */
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: all 0.3s;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Chat Page Layout */
.app-container {
    width: 95vw;
    height: 90vh;
    display: flex;
}

.sidebar {
    width: 320px;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.user-item {
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-item.active {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h4 {
    font-size: 1rem;
    font-weight: 600;
}

.user-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary);
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    display: block;
    text-align: right;
}

.chat-input-area {
    padding: 24px;
    border-top: 1px solid var(--glass-border);
}

.input-wrapper {
    display: flex;
    gap: 12px;
}

.input-wrapper input {
    flex: 1;
}

.input-wrapper button {
    width: auto;
    padding: 0 24px;
}

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

.message {
    animation: fadeIn 0.3s ease-out;
}

/* Voice Room Specific Styles */
.voice-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.voice-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
}

#speakersList {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
    gap: 15px !important;
    width: 100% !important;
    justify-content: center !important;
}

.voice-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.voice-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    width: 80px;
    position: relative;
}

.voice-participant:hover {
    background: rgba(255, 255, 255, 0.1);
}

.voice-participant .avatar {
    width: 40px;
    height: 40px;
}

.voice-participant .name {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

.mute-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mute-btn.muted {
    background: #22c55e !important;
}
.mute-btn:not(.muted) {
    background: #ef4444 !important;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.mic-active {
    animation: pulse 2s infinite;
}

.voice-menu {
    position: absolute;
    background: var(--bg-dark);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 10px;
    z-index: 999999;
    box-shadow: 0 15px 35px rgba(0,0,0,0.8);
    display: none;
    min-width: 150px;
    backdrop-filter: blur(10px);
}

.voice-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: none;
    font-size: 0.85rem;
    border-radius: 6px;
}

.voice-menu button:hover {
    background: rgba(255,255,255,0.1);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .app-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        flex-direction: column;
    }

    /* Hide sidebar when a chat/room is active on mobile */
    .sidebar {
        width: 100%;
        height: 100%;
        display: none; /* Default hide, will show if no receiver is active */
    }

    /* If no active receiver, show sidebar */
    body:not(.has-active-chat) .sidebar {
        display: flex;
    }

    .chat-main {
        height: 100%;
        width: 100%;
    }

    .voice-container {
        flex-direction: column;
    }

    .voice-sidebar {
        width: 100%;
        height: auto;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 10px;
        overflow-y: auto;
    }

    .voice-sidebar h4 {
        display: none;
    }

    #speakersList {
        justify-content: center;
    }

    .voice-main {
        padding: 10px;
        justify-content: center;
        flex: 1;
    }

    /* Mobil Moderasyon Menüsü - Orta Ekran Popup */
    .voice-menu {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 80% !important;
        max-width: 300px !important;
        padding: 20px !important;
        background: rgba(15, 23, 42, 0.98) !important;
        border: 2px solid var(--accent) !important;
        border-radius: 24px !important;
        box-shadow: 0 0 100px rgba(0,0,0,0.8) !important;
    }


    #voiceStatus {
        margin-top: 10px;
        margin-bottom: 15px !important;
    }

    #micIconWrapper {
        width: 70px;
        height: 70px;
        margin-bottom: 15px !important;
    }

    #micIcon {
        font-size: 2rem;
    }

    #statusText {
        font-size: 1.2rem !important;
    }

    .voice-participant {
        width: 80px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 6px !important;
        margin: 0 auto !important;
    }



    .voice-participant .avatar {
        width: 32px;
        height: 32px;
    }

    .voice-participant .name {
        font-size: 0.8rem;
    }

    .voice-main button {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
        width: auto !important;
        min-width: 120px;
    }


    .chat-header {
        padding: 12px 16px;
    }

    .messages-container {
        padding: 16px;
    }

    .chat-input-area {
        padding: 16px 16px 55px; /* Daha fazla yukarı taşıyarak tüm cihazlarda erişilebilirliği sağlıyoruz */
    }

    #mobileBackBtn, #mobileBackBtn2 {
        display: block !important;
        margin-right: 10px;
    }
}

/* Sabitlenen Mesaj Stili */
.pinned-message {
    background: rgba(239, 68, 68, 0.15);
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 16px;
    color: #fca5a5;
    animation: blink-pin 2s infinite;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

@keyframes blink-pin {
    0% { opacity: 1; border-color: rgba(239, 68, 68, 0.5); }
    50% { opacity: 0.7; border-color: rgba(239, 68, 68, 0.1); }
    100% { opacity: 1; border-color: rgba(239, 68, 68, 0.5); }
}

.pin-btn {
    cursor: pointer;
    font-size: 0.7rem;
    color: #fca5a5;
    font-weight: bold;
    margin-left: 8px;
}

/* Sesli Katılımcı Izgarası */
#voiceParticipants {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
    width: 100%;
    justify-items: center;
}

.voice-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
}

.voice-participant:hover {
    transform: scale(1.05);
}

.room-link {
    transition: all 0.2s;
    border-radius: 4px;
}

.room-link:hover {
    background: rgba(255,255,255,0.05);
    padding-left: 5px !important;
    color: var(--accent) !important;
}

.group-header:hover {
    color: var(--accent);
}

.voice-menu {
    display: none;
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 5px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.voice-menu button {
    display: block;
    width: 100%;
    padding: 8px 15px;
    background: none;
    border: none;
    color: white;
    text-align: left;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
}

.voice-menu button:hover {
    background: rgba(255,255,255,0.05);
}



