/* =========================================
   3 SÜTUNLU ANA SAYFA (GRID)
   ========================================= */
.home-layout-grid {
    display: grid;
    /* Sol (270px) | Orta (Esnek) | Sağ (270px) */
    /* Yanları biraz kıstık ki ortadaki Chat'e yer kalsın ama 1250px'e sığsın */
    grid-template-columns: 260px 1fr 265px;
    gap: 16px;
    /* Diğer sayfalarla aynı boşluk */

    /* KRİTİK AYAR 1: GENİŞLİK SINIRI */
    max-width: 1250px;
    /* Partiler ve Meclis sayfasıyla birebir aynı */
    margin: 0 auto;
    /* Ortala */

    padding: 20px;

    /* KRİTİK AYAR 2: ALT SINIR */
    height: calc(100vh - 130px);
    /* Dikey alanı daha agresif doldur */
    /* Header + Footer/Padding telafisi */
    min-height: 500px;

    overflow: hidden;
    align-items: stretch;
    /* İçerideki sütunları boydan boya uzat */
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================
   SOL VE SAĞ SÜTUNLAR (WIDGET ALANLARI)
   ========================================= */
.home-col-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 5px;
    height: 100%;
}

/* Meclis widget kalan alanı doldursun */
.parliament-widget {
    flex: 1;
    min-height: 0;
}

.home-col-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 5px;
    height: 100%;
}


/* Sağ sütun widget'ları eşit alan paylaşsın */
.trending-widget,
.market-widget {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Scrollbarı gizle */
.home-col-left::-webkit-scrollbar,
.home-col-right::-webkit-scrollbar {
    display: none;
}

/* ORTAK WIDGET STİLİ */
.home-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.widget-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.widget-header h3 {
    font-size: 0.78rem;
    color: var(--text-light);
    font-weight: 700;
}

.widget-header h3 i {
    font-size: 0.72rem;
}

.widget-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* 1. GÖREVLER (Kırmızı Çerçeve) */
/* .task-widget { border-top: 3px solid #ef4444; } */
/* İsteğe bağlı renkli çizgi */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 5px;
    font-size: 0.78rem;
    border: 1px solid transparent;
}

.task-item.completed {
    border-color: #10b981;
    color: #10b981;
    opacity: 0.7;
}

.task-info {
    display: flex;
    flex-direction: column;
}

.task-title {
    color: var(--text-light);
}

.task-reward {
    font-size: 0.65rem;
    color: #eab308;
}

/* Dünyadan Haberler: sabit boyut, içerik scroll */
.world-widget .widget-body {
    max-height: 110px;
    overflow-y: auto;
}

.world-widget .widget-body::-webkit-scrollbar {
    width: 3px;
}

.world-widget .widget-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* 2. DÜNYA HABERLERİ (Turuncu) */
.news-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.news-item:last-child {
    border: none;
    padding-bottom: 0;
}

.news-item img {
    border-radius: 2px;
    width: 18px;
    height: 13px;
}

.news-content {
    display: flex;
    flex-direction: column;
}

.news-head {
    font-size: 0.78rem;
    color: #cbd5e1;
}

.news-time {
    font-size: 0.65rem;
    color: var(--text-dim);
}

/* 3. BÖLGE/KONUM (Mavi) */
.region-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
}

.region-flag {
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    width: 40px;
}

.region-info div {
    display: flex;
    flex-direction: column;
}

.region-info strong {
    color: var(--text-light);
    font-size: 0.82rem;
}

.region-info small {
    color: #10b981;
    font-size: 0.7rem;
}

/* 4. GÜNDEM (Sarı) */
.agenda-item {
    padding: 5px 8px;
    background: var(--bg-main);
    border-radius: 5px;
    font-weight: 600;
    color: #cbd5e1;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
}

.trend-up {
    color: #10b981;
}

.trend-down {
    color: #ef4444;
}

/* 5. SOSYAL MEDYA */
.social-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
    border-radius: 5px;
    font-size: 0.75rem;
}

.social-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.75rem;
}

.social-likes {
    color: var(--text-dim);
    font-size: 0.65rem;
}

.social-item p {
    color: #cbd5e1;
    font-style: italic;
}

/* 6. MECLİS DURUMU */
.parl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.78rem;
}

.parl-color {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.parl-name {
    flex: 1;
    color: var(--text-dim);
}

.parl-count {
    font-weight: 700;
    color: var(--text-light);
}

.parl-more {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 5px;
}

/* GÜNDEM/POPÜLER SEKMELİ WİDGET */
.trending-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.trending-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 8px 10px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
    font-size: 0.78rem;
    font-family: inherit;
}

.trending-tab:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.02);
}

.trending-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.trending-body {
    position: relative;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.trending-body::-webkit-scrollbar {
    width: 3px;
}

.trending-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.trend-panel {
    display: none;
}

.trend-panel.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* PİYASA & BORSA WİDGET */
.market-widget {
    margin-top: 0;
}

.market-news-item {
    padding: 8px;
    background: var(--bg-main);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.market-news-title {
    font-size: 0.82rem;
    color: #e2e8f0;
    font-weight: 500;
    display: block;
}

.market-news-meta {
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-top: 2px;
    display: block;
}

/* Borsa Satırları */
.stock-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stock-section+.stock-section {
    margin-top: 6px;
}

.stock-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stock-section-label.up {
    color: #10b981;
}

.stock-section-label.down {
    color: #ef4444;
}

.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.015);
    transition: background 0.15s;
}

.stock-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.stock-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-symbol {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-light);
    min-width: 32px;
}

.stock-name {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.stock-data {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: right;
}

.stock-price {
    font-size: 0.78rem;
    color: #cbd5e1;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.stock-change {
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 52px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.stock-change.up {
    color: #10b981;
}

.stock-change.down {
    color: #ef4444;
}

/* =========================================
   ORTA SÜTUN: CHAT (BEYAZ ALAN)
   ========================================= */
.home-col-center {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    min-height: 0;
    min-width: 0;
    align-self: stretch;
}

.chat-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    flex: 1;
    /* TÜM ALANI DOLDUR */
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    position: relative;
}

.chat-header-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.chat-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 15px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.chat-tab:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.02);
}

.chat-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.chat-messages-area {
    flex: 1;
    /* MESAJ ALANINI UZAT */
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(15, 23, 42, 0.2);
    /* Bütünleşik koyu arka plan */
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-messages-area::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Balonlar */
.chat-msg {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 85%;
}

.chat-msg.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg.system {
    align-self: center;
    max-width: 100%;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-msg.me .msg-bubble {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 2px;
}

.chat-msg.system .msg-bubble {
    background: transparent;
    border: none;
    font-style: italic;
    color: var(--accent);
}

.msg-author {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 2px;
}

.chat-msg.me .msg-author {
    display: none;
}

.msg-text {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.msg-time {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-align: right;
    margin-top: 4px;
}

.chat-img-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 6px;
    margin-top: 5px;
    cursor: pointer;
}

/* Input - Premium */
.chat-input-wrapper {
    padding: 12px 15px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0;
}

.chat-input-box {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 4px 4px 4px 14px;
    flex: 1;
    transition: all 0.25s;
}

.chat-input-box:focus-within {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.03);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.06);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 0;
    color: #e2e8f0;
    outline: none;
    font-size: 0.82rem;
    font-family: inherit;
}

#chat-input::placeholder {
    color: #3e4c5e;
}

#chat-send-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 9px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

#chat-send-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.35);
    transform: scale(1.05);
}

#chat-send-btn:active {
    transform: scale(0.95);
}

/* MOBİL */
@media (max-width: 1000px) {
    .home-layout-grid {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .chat-container {
        height: 500px;
    }

    /* Mobilde yan sütunları alta atalım */
    .home-col-left,
    .home-col-right {
        order: 2;
        overflow: visible;
    }

    .home-col-center {
        order: 1;
    }
}