/* Meydan Pro - Core Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors */
    --primary: #2979ff;
    --primary-hover: #2962ff;
    --accent: #00e676;
    --danger: #ff1744;

    /* Backgrounds */
    --bg-dark: #0a0a0f;
    --bg-panel: #13131f;
    --bg-input: rgba(255, 255, 255, 0.05);

    /* Glass Effect */
    --glass-bg: rgba(20, 20, 30, 0.65);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --blur-amount: 16px;

    /* Typography */
    --text-main: #ffffff;
    --text-muted: #8F90A6;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- THEMES --- */
body.theme-emerald {
    --primary: #00e676;
    --primary-hover: #00c853;
}

body.theme-sunset {
    --primary: #f50057;
    --primary-hover: #c51162;
    --accent: #ff4081;
}

body.theme-nordic {
    --primary: #00bcd4;
    --primary-hover: #0097a7;
    --accent: #4dd0e1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    /* Subtle premium gradient background */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(41, 121, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 230, 118, 0.1) 0%, transparent 40%);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    /* App feel */
    -webkit-font-smoothing: antialiased;
}

/* --- UTILITIES --- */
.hidden {
    display: none !important;
}

.presence-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #13131f;
    z-index: 2;
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-reactions {
    position: absolute;
    bottom: -15px;
    right: 10px;
    display: flex;
    gap: 3px;
    background: #1e1e2d;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 5;
}

.outgoing .msg-reactions {
    right: auto;
    left: 10px;
}

#reactionPicker {
    position: fixed;
    background: #1e1e2d;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 8px 15px;
    display: flex;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0);
}

#reactionPicker.active {
    transform: scale(1);
}

#reactionPicker span {
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

#reactionPicker span:hover {
    transform: scale(1.4);
}

/* --- AUTH SCREEN --- */
.auth-wrapper {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
}

.auth-card {
    display: flex;
    width: 100%;
    max-width: 900px;
    height: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount));
    border: var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

/* Auth Left: Brand */
.auth-brand {
    flex: 1;
    background: linear-gradient(135deg, rgba(41, 121, 255, 0.1) 0%, rgba(0, 0, 0, 0.2) 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border-right: var(--glass-border);
}

.auth-brand h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #b3e5fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-brand p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.feature-list {
    list-style: none;
}

.feature-list li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e0e0e0;
}

.feature-list i {
    color: var(--accent);
}

/* Auth Right: Forms */
.auth-forms {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    /* Ensure clicking works */
    z-index: 20;
}

.auth-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.auth-tab {
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
}

.auth-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.auth-tab.active {
    color: var(--primary);
    background: rgba(41, 121, 255, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(41, 121, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.checkbox-group input {
    margin-top: 3px;
    accent-color: var(--primary);
}

/* --- APP LAYOUT --- */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.app-sidebar {
    width: 320px;
    background: var(--bg-panel);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #b388ff);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.user-info .name {
    font-weight: 600;
    display: block;
}

.user-info .status {
    font-size: 0.75rem;
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.nav-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(41, 121, 255, 0.15);
}

.nav-item .nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.nav-item.active .nav-icon {
    background: var(--primary);
    color: white;
}

.nav-text {
    flex: 1;
}

.nav-title {
    font-weight: 500;
}

.nav-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
}

.chat-header {
    height: 70px;
    padding: 0 30px;
    border-bottom: var(--glass-border);
    display: flex;
    align-items: center;
    background: rgba(19, 19, 31, 0.8);
    backdrop-filter: blur(10px);
}

.chat-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 70%;
    align-self: flex-start;
    display: flex;
    gap: 10px;
}

.message.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-bubble {
    background: #252530;
    padding: 12px 18px;
    border-radius: 18px 18px 18px 2px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message.outgoing .msg-bubble {
    background: var(--primary);
    border-radius: 18px 18px 2px 18px;
}

.msg-text {
    font-size: 0.95rem;
    word-break: break-word;
}

.msg-meta {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    text-align: right;
}

/* Input Area */
.chat-input-area {
    padding: 20px 30px;
    background: rgba(19, 19, 31, 0.9);
    border-top: var(--glass-border);
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 12px 20px;
    color: white;
    font-size: 0.95rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .auth-card {
        flex-direction: column;
        height: auto;
        border-radius: 0;
    }

    .auth-brand {
        padding: 30px 20px;
        border-right: none;
        border-bottom: var(--glass-border);
    }

    .auth-forms {
        padding: 30px 20px;
    }

    .app-sidebar {
        width: 80px;
        /* Mini sidebar */
    }

    .keyboard-visible .auth-brand {
        display: none;
    }
}

@keyframes toastIn {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast {
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--primary);
    padding: 15px 20px;
    border-radius: 12px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 250px;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 10px;
}

.toast:hover {
    transform: translateY(-2px);
    background: rgba(30, 30, 45, 0.95);
}

/* Premium V5.0 Bubbles */
.msg-bubble {
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: 0.2s;
}

.msg-item.outgoing .msg-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover)) !important;
    border: none !important;
    box-shadow: 0 5px 20px rgba(41, 121, 255, 0.2);
}

.msg-item.incoming .msg-bubble {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.msg-item.incoming .msg-text {
    color: #e0e0e0 !important;
}

.msg-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Stories / Durum List */
#statusList::-webkit-scrollbar {
    display: none;
}

#statusList>div {
    transition: 0.2s;
}

#statusList>div:hover {
    transform: scale(1.05);
}

.ai-msg .msg-bubble {
    background: rgba(41, 121, 255, 0.1) !important;
    border: 1px solid rgba(41, 121, 255, 0.3) !important;
    box-shadow: 0 0 15px rgba(41, 121, 255, 0.2);
}

.ai-msg .msg-bubble::before {
    content: '\f544';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: -10px;
    top: -10px;
    background: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-panel);
}

/* --- MEYDAN PRIME (Reply & Edit) --- */

/* Context Menu */
#contextMenu {
    position: absolute;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 180px;
    z-index: 10000;
    display: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.1s ease-out;
}

#contextMenu.active {
    display: block;
}

#contextMenu div {
    padding: 10px 15px;
    cursor: pointer;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    transition: 0.2s;
}

#contextMenu div:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Reply Banner */
#replyBanner {
    display: none;
    background: rgba(41, 121, 255, 0.1);
    border-bottom: 1px solid rgba(41, 121, 255, 0.2);
    padding: 10px 15px;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.2s;
    border-radius: 15px 15px 0 0;
    margin-bottom: -15px;
    /* Pull into input area */
    z-index: 1;
    position: relative;
    /* For z-index to work */
}

#replyBanner.active {
    display: flex;
}

@keyframes slideDown {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Quoted Message */
.msg-quote {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    padding: 5px 10px;
    margin-bottom: 5px;
    cursor: pointer;
    opacity: 0.8;
    transition: 0.2s;
}

.msg-quote:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.3);
}

.quote-sender {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 2px;
}

.quote-text {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Edited Tag */
.msg-edited {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 5px;
    font-style: italic;
}