:root {
    --bg-main: #ffffff;
    --bg-sidebar: #f9f9f9;
    --bg-hover: #ececec;
    --bubble-user: #f4f4f4;
    --bubble-ai: transparent;
    --text-main: #0d0d0d;
    --text-muted: #676767;
    --border-color: #e5e5e5;
    --accent-black: #000000;
}


@font-face {
    font-family: 'Yazı';
    src: url('fonts/Poppins-Light.ttf') format('truetype');
    font-style: normal;
}

@font-face {
    font-family: 'Başlık';
    src: url('fonts/Boldonse-Regular.ttf') format('truetype');
    font-style: normal;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Yazı', sans-serif;

}

.page {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.sidecontent {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    width: 25%;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

.sidecontent {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    overflow: hidden;
}

::-webkit-scrollbar {
    width: 10px;


}

:-webkit-scrollbar-track {
    margin-top: 100px;
    margin-bottom: 50px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-black);
}

::-webkit-scrollbar:hover {
    background: var(--bg-main);
}

.exit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-bottom: 20px;
    padding-top: 10px;
    width: 100%;

    border-top: solid 1px var(--border-color);

}

.exit span {


    height: auto;
    width: auto;
    text-align: center;
    align-items: center;
    font-size: 20px;
    font-family: 'Başlık';
}

.exit button {
    background: transparent;
    border: none;
}

.exit svg {
    width: auto;
    height: 40px;
    display: block;

}

.sidebar .chat_header {
    font-family: 'Başlık';
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
    margin: 0;
    text-align: center;
    font-size: 25px;
    color: var(--text-main);
}

.chat_header h2 {
    margin: 0;
    padding: 0;
    font-size: 26px;
    color: var(--text-main);
    word-break: break-word;
}

.chat_search {
    display: flex;
    align-items: center;
    justify-content: space-between;

    border: 1px solid var(--border-color);
    border-radius: 3rem;
    height: 35px;
    padding: 0 10px;
    margin: 10px 0;
}

.search_input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Yazı';
    font-size: 14px;
    height: 100%;
}

.chats {

    overflow-y: auto;
}

.chat-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;

    height: 75px;
    padding: 0 15px;
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
    width: 100%;
}


.chat-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-link:hover {
    background-color: var(--bg-hover);
}

.chat-link.active-chat {
    background-color: #ececec;
}


.chat-name {
    color: var(--text-main);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 1px;
}

.chat-last-msg {
    color: var(--text-muted);
    font-size: 13px;
}

.content {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.content_inside {
    background-color: var(--bg-main);
    flex: 1;
    padding: 20px;
    overflow-y: auto;


}

.content_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 89.5px;
    border-bottom: 1px solid var(--border-color);
}

.back {
    padding-right: 10px;
    align-items: center;
    display: flex;
}

.content .header-icons {
    display: flex;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.header-profile-circle {
    width: 38px;
    height: 38px;
    background-color: #ddd;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.user-info h1 {
    font-family: 'Yazı';
    font-size: 25px;
    font-weight: 600;
    margin: 10px;
    color: var(--text-main);
}

svg {
    height: 20px;
    width: 20px;
    fill: var(--text-main);
    cursor: pointer;
    display: block;
}

.message_box {

    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-main);
    width: 90%;
    max-width: 1200px;

    padding: 0 20px;
    height: 50px;
    border: 1px solid var(--border-color);
    border-radius: 3rem;
    margin: 0 auto 30px auto;



}

.message_box_inner {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

.message_input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Yazı';
    font-size: 16px;
    height: 100%;
}

.send-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    color: var(--text-main);
    cursor: pointer;
    margin-left: 10px;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .page {
        flex-direction: column;
    }

    .content {
        width: 100%;
    }

    .message_box {
        position: fixed !important;
        bottom: 20px !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 20px) !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
        z-index: 1000 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        justify-content: center !important;
    }

    .message_box_inner {
        display: flex;
        align-items: center;
        background: #fff;
        width: 95%;
        height: 50px;
        border-radius: 25px;
        padding: 0 15px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        border: 1px solid var(--border-color);
        box-sizing: border-box;
    }

    .content_inside {
        padding-bottom: 100px !important;
    }

    .user-info h1 {
        font-size: 18px;
    }
}


.message-item {
    position: relative;
    margin-bottom: 10px;
    margin-left: 30px;
    padding: 10px;
    padding-right: 30px;
    padding-bottom: 22px;
    border-radius: 10px;
    width: fit-content;
    max-width: 70%;
    word-break: break-word;
}

.message-time {
    position: absolute;
    bottom: 4px;
    right: 10px;
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.msg-dropdown-btn {
    position: absolute;
    top: 30%;
    right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: none;
    fill: #666;
    background: transparent;
    border: none;
    padding: 0;
    font-family: 'Başlık';
}

.message-item:hover .msg-dropdown-btn {
    display: block;
}

.msg-dropdown-menu {
    position: absolute;
    top: 25px;
    right: 5px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 8px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.msg-dropdown-menu button {
    background: transparent;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    color: black;
    font-family: 'Yazı';
    font-size: 14px;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.msg-dropdown-menu button:hover {
    background: #000;
    color: #fff;
}


.message-item.selectable {
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s, border 0.2s;
}

.message-item.selectable:hover {
    opacity: 0.8;
}

.message-item.selected {
    border: 2px solid #007bff !important;
    background-color: #e6f2ff !important;
}

.selection-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-main);
    width: 90%;
    max-width: 1200px;
    padding: 0 20px;
    height: 50px;
    border: 1px solid var(--border-color);
    border-radius: 3rem;
    margin: 0 auto 30px auto;
}

.selection-bar button {
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Yazı';
    font-size: 14px;
}

.btn-delete-selected {
    background-color: #ff4d4d;
    color: white;
    transition: all 0.2s ease;
}

.btn-delete-selected:hover {
    background-color: white;
    color: #ff4d4d;
    box-shadow: inset 0 0 0 2px #ff4d4d;
}

.btn-cancel-selection {
    background-color: #ccc;
    color: black;
    transition: all 0.2s ease;
}

.btn-cancel-selection:hover {
    background-color: black;
    color: white;
}


.sidebar-tabs {
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.sidebar-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    font-family: 'Başlık';
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.sidebar-tab.active {
    color: var(--text-main);
    border-bottom: 2px solid var(--accent-black);
}

.sidebar-tab:hover {
    color: var(--text-main);
}

.add-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 700;
    font-family: 'Başlık';
    color: #333;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.add-chat-btn:hover {
    background: #000;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: #000;
}

.add-chat-btn svg {
    stroke: currentColor;
    fill: none;
    transition: all 0.3s ease;
}

.add-chat-btn:hover svg {
    transform: scale(1.1);
}


.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}


.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;


    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}


.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    transition: 0.2s;
}

.close-modal:hover {
    color: #333;
}


.modal-content h3 {
    margin-bottom: 25px;
    font-weight: 700;
    color: #1a1a1a;
    font-family: 'Başlık';
}

.modal-content p {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    text-align: left;
    padding-left: 5px;
}


.link-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px dashed #cbd5e0;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#modal-my-link {
    flex: 1;
    font-size: 12px;
    color: #4a5568;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

#modal-copy-btn {
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

#modal-copy-btn:hover {
    background: #e2e8f0;
}


.divider {
    display: flex;
    align-items: center;
    color: #a0aec0;
    font-size: 13px;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.divider:not(:empty)::before {
    margin-right: 15px;
}

.divider:not(:empty)::after {
    margin-left: 15px;
}


#modal-add-input, #modal-group-name-input, #modal-join-group-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

#modal-add-input:focus, #modal-group-name-input:focus, #modal-join-group-input:focus {
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

#modal-confirm-btn, #modal-create-group-btn, #modal-join-group-btn {
    width: 100%;
    padding: 14px;
    background: #000;
    color: #fff;
    border: 2px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#modal-confirm-btn:hover, #modal-create-group-btn:hover, #modal-join-group-btn:hover, #start-selected-call-btn:hover {
    background: #fff;
    color: #000;
    border-color: #000;
}

#start-selected-call-btn {
    width: 100%;
    padding: 14px;
    background: #000;
    color: #fff;
    border: 2px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-copy-btn-style {
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.modal-copy-btn-style:hover {
    background: #e2e8f0;
}

#group-invite-link {
    flex: 1;
    font-size: 12px;
    color: #4a5568;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.members-list {
    max-height: 180px;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 15px;
    text-align: left;
    color: #333;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.participants-list {
    max-height: 250px;
    overflow-y: auto;
    margin: 15px 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.participants-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.participants-list label:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.participants-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #000;
    cursor: pointer;
}

.sender-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 3px;
    color: #555;
}

.message-search-bar {
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
}

.message-search-input {
    flex: 1;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0 15px;
    outline: none;
    font-family: 'Yazı';
    font-size: 14px;
}

.message-search-input:focus {
    border-color: var(--accent-black);
}

#message-search-count {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

#message-search-close {
    border: none;
    background: #f0f0f0;
    border-radius: 18px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: 'Yazı';
}

#message-search-close:hover {
    background: #e0e0e0;
}

.message-item.search-hidden {
    opacity: 0.25;
}

.message-item.search-match {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.message-item.search-match.active-match {
    outline: 3px solid #ffc107;
    background-color: #fff3cd !important;
}

.chat-link.sidebar-search-match {
    background-color: #fff3cd;
}

.chat-link.sidebar-search-active {
    background-color: #ffeeba;
    box-shadow: inset 4px 0 0 #ffc107;
}



.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-panel {
    background: #fff;
    border-radius: 20px;
    padding: 40px 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    animation: callPanelIn 0.3s ease-out;
}

@keyframes callPanelIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

.call-panel-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-panel-icon.active {
    animation: pulseGreen 1.5s ease-in-out infinite;
}

@keyframes pulseGreen {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(76, 175, 80, 0);
    }
}

.call-panel-status {
    font-size: 14px;
    color: #888;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.call-panel-name {
    font-size: 24px;
    font-weight: 600;
    color: #222;
    margin: 0;
}

.call-timer {
    font-size: 32px;
    font-weight: 300;
    color: #333;
    font-variant-numeric: tabular-nums;
}

.call-btn-group {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.call-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.call-btn:hover {
    transform: scale(1.05);
}

.call-btn-accept {
    background: #4CAF50;
    color: #fff;
    border: 2px solid transparent;
}

.call-btn-accept:hover {
    background: #fff;
    color: #4CAF50;
    border-color: #4CAF50;
}

.call-btn-reject {
    background: #f44336;
    color: #fff;
    border: 2px solid transparent;
}

.call-btn-reject:hover {
    background: #fff;
    color: #f44336;
    border-color: #f44336;
}

.call-btn-mute {
    background: #eee;
    color: #333;
    border: 2px solid transparent;
}

.call-btn-mute:hover {
    background: #333;
    color: #eee;
}

.call-btn-mute.muted {
    background: #ff9800;
    color: #fff;
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-wrapper {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 100;
}

.profile-avatar-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: #ddd;
    border: 2px solid var(--border-color);
    background-size: cover;
    background-position: center;
    transition: border-color 0.2s;
}

.profile-avatar-wrapper:hover .profile-avatar-circle {
    border-color: #999;
}

.profile-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.profile-avatar-wrapper:hover .profile-avatar-overlay {
    opacity: 1;
}

.profile-avatar-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-avatar-menu {
    position: absolute;
    top: 52px;
    left: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 8px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 200;
    display: none;
    min-width: 150px;
    overflow: hidden;
}

.profile-avatar-menu button {
    background: transparent;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-main);
    font-family: 'Yazı';
    font-size: 14px;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.profile-avatar-menu button:hover {
    background: #000;
    color: #fff;
}

.profile-avatar-menu button:last-child {
    color: #e53935;
}

.profile-avatar-menu button:last-child:hover {
    background: #e53935;
    color: #fff;
}

/* --- Mobile Responsive Improvements --- */
@media (max-width: 768px) {
    body {
        padding: 0;
        overflow: hidden;
    }

    .main-container {
        flex-direction: column;
        height: 100vh;
        width: 100vw;
    }

    .sidebar {
        width: 100% !important;
        height: 100% !important;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 20;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #fff;
        display: flex !important;
        transform: translateX(0);
        /* Mobilde ilk açılışta sidebar görünür */
    }

    /* Eğer bir sohbet açıksa sidebar'ı sola kaydır ve gizle */
    body.chat-open .sidebar {
        transform: translateX(-100%);
        pointer-events: none;
    }

    .chat-area {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        left: 0;
        top: 0;
        z-index: 10;
        transform: translateX(100%);
        /* Mobilde ilk açılışta chat gizli */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
        background: #fff;
    }

    body.chat-open .chat-area {
        transform: translateX(0);
        z-index: 30;
    }

    /* Sidebar Header & Profile Fix */
    .sidebar-header {
        padding: 10px 15px !important;
    }

    .sidebar-profile {
        padding: 10px 15px !important;
    }

    .message-search-container {
        margin: 5px 15px 15px 15px !important;
    }

    /* Chat Area UI Fixes */
    .chat-header {
        padding: 10px 15px !important;
        height: 60px;
    }

    #back-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        margin-right: 10px;
    }

    /* Modal Fixes */
    .modal-content {
        width: 85% !important;
        padding: 20px !important;
        margin: 10% auto;
    }

    /* Empty state text fix */
    .no-chat-selected {
        display: none !important;
        /* Mobilde bu yazıya gerek yok */
    }
}