/* ==========================================================================
   dashboard.css — Giriş ekranı / özet sayfası
   ========================================================================== */

.page-header__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.page-header__meta .page-subtitle {
    margin: 0;
}

/* --------- Depo panelleri (ürün + yem) --------- */
.storage-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    margin-top: 16px;
}

.storage-row > * { min-width: 0; }

/* Mobilde depo panelleri — başlıktan açılır/kapanır */
.storage-panel__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: default;
}

.storage-panel__toggle-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.storage-panel__hint {
    display: none;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storage-panel__chevron {
    display: none;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.warehouse-panel .panel__body,
.feed-silo-panel .panel__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Depodaki ürün satırları */
.warehouse-items {
    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
}

.warehouse-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.warehouse-item:last-child { border-bottom: none; }

.warehouse-item__img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 3px;
    background-color: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.warehouse-item__info {
    flex: 1;
    min-width: 0;
}

.warehouse-item__name {
    font-size: 13px;
    font-weight: 700;
}

.warehouse-item__price {
    font-size: 11px;
    color: var(--text-secondary);
}

.warehouse-item__amount {
    text-align: right;
    flex-shrink: 0;
}

.warehouse-item__qty {
    font-size: 13px;
    font-weight: 700;
}

.warehouse-item__value {
    font-size: 11px;
    color: var(--gold-color);
}


/* --------- Yem satın alma alanı --------- */
.feed-buy {
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.feed-buy__title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.feed-buy__quick {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.feed-buy__quick .btn { flex: 1; min-width: 92px; }

.feed-buy__custom {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.feed-buy__custom .field {
    flex: 1;
    min-width: 130px;
    margin-bottom: 0;
}

.feed-buy__total {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.feed-buy__total strong {
    color: var(--gold-color);
    font-size: 14px;
}

/* --------- Kazanç grafiği --------- */
.dashboard-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
    align-items: stretch;
}

.dashboard-chart-row > * { min-width: 0; }

.chart-panel .panel__body {
    padding: 18px 18px 14px;
    background: linear-gradient(180deg, rgba(229, 182, 83, 0.04) 0%, var(--background-dark) 42%);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.chart-canvas-wrap {
    position: relative;
    height: 300px;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.chart-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 2;
    min-width: 120px;
    padding: 8px 11px;
    background: var(--background-card);
    border: 1px solid rgba(229, 182, 83, 0.45);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    font-size: 12px;
    line-height: 1.45;
    transform: translate(-50%, -110%);
    white-space: nowrap;
}

.chart-tooltip__day {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.chart-tooltip__value {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold-color);
}

.chart-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.chart-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-legend__swatch {
    width: 18px;
    height: 4px;
    border-radius: 999px;
}

.chart-legend__swatch--gold {
    background: linear-gradient(90deg, #c9972e, #e5b653);
}

.chart-legend__hint {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.85;
}

/* Geçen ay kazanç paneli */
.earnings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.earnings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    background-color: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.earnings-item__label {
    font-size: 12px;
    color: var(--text-secondary);
}

.earnings-item__value {
    font-size: 18px;
    font-weight: 700;
}

.earnings-range {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Sunucu sohbeti */
.dashboard-chat {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.dashboard-chat__inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 380px;
}

.dashboard-chat__messages {
    flex: 1;
    min-height: 260px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: var(--background-dark);
    border-bottom: 1px solid var(--border-color);
}

.dashboard-chat__messages .chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 88%;
}

.dashboard-chat__messages .chat-msg:not(.chat-msg--mine) {
    align-self: flex-start;
}

.dashboard-chat__messages .chat-msg--mine {
    flex-direction: row-reverse;
    align-self: flex-end;
    margin-left: auto;
}

.dashboard-chat__messages .chat-msg__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dashboard-chat__messages .chat-msg--mine .chat-msg__body {
    align-items: flex-end;
}

.dashboard-chat__messages .chat-msg__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.dashboard-chat__messages .chat-msg--mine .chat-msg__meta {
    justify-content: flex-end;
}

.dashboard-chat__messages .chat-msg__name {
    font-size: 12px;
    font-weight: 700;
}

.dashboard-chat__messages .chat-msg__level {
    font-size: 10px;
    color: var(--text-secondary);
}

.dashboard-chat__messages .chat-msg__time {
    font-size: 10px;
    color: var(--text-secondary);
}

.dashboard-chat__messages .chat-msg__text {
    font-size: 13px;
    color: var(--text-primary);
    background-color: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    padding: 8px 11px;
    display: inline-block;
    word-break: break-word;
    max-width: 100%;
}

.dashboard-chat__messages .chat-msg--mine .chat-msg__text {
    background: rgba(112, 191, 216, 0.16);
    border-color: rgba(112, 191, 216, 0.35);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 4px;
}

.dashboard-chat__notice {
    padding: 8px 14px 0;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.dashboard-chat__form {
    display: flex;
    gap: 8px;
    padding: 12px 14px 14px;
}

.dashboard-chat__form .input {
    flex: 1;
    min-width: 0;
}

.dashboard-chat__empty {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 24px 12px;
}

.chat-msg__trigger {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.chat-msg__trigger.chat-msg__name {
    font-size: 12px;
    font-weight: 700;
}

.chat-msg__trigger.chat-msg__name:hover,
.chat-msg__trigger.chat-msg__avatar-btn:hover {
    opacity: 0.85;
}

.chat-msg__avatar-btn {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    border-radius: 50%;
    line-height: 0;
}

.chat-user-menu {
    position: fixed;
    z-index: calc(var(--z-modal) - 1);
    min-width: 210px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    padding: 6px;
}

.chat-user-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 6px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.chat-user-menu__head strong {
    font-size: 13px;
}

.chat-user-menu__head span {
    color: var(--text-secondary);
}

.chat-user-menu__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.chat-user-menu__item:hover {
    background: var(--background-dark);
}

.chat-user-menu__item:disabled {
    opacity: 0.55;
    cursor: default;
}

.chat-user-menu__item:disabled:hover {
    background: none;
}

.chat-user-menu__item--danger {
    color: #e07070;
}

.chat-profile-modal__body {
    text-align: center;
}

.chat-profile-modal__name {
    margin-top: 12px;
    font-size: 18px;
    font-weight: 700;
}

.chat-profile-modal__level {
    margin-top: 4px;
    color: var(--active-color);
    font-size: 13px;
}

.chat-profile-modal__meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-profile-modal__table {
    width: 100%;
    margin-top: 16px;
    font-size: 13px;
    border-collapse: collapse;
}

.chat-profile-modal__table th,
.chat-profile-modal__table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.chat-profile-modal__table th {
    color: var(--text-secondary);
    font-weight: 500;
    width: 40%;
}

/* --------- Alt paneller --------- */
.dashboard-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.dashboard-bottom-row > * { min-width: 0; }

.top-farmers-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-color);
}

.top-farmers-list li:last-child {
    border-bottom: none;
}

.top-farmers-rank {
    width: 22px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
}

.top-farmers-name {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
}

.invite-box {
    text-align: center;
}

.invite-code {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.invite-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.invite-code-meta {
    margin-top: 8px;
    word-break: break-all;
}

.invite-code-meta strong {
    color: var(--gold-color);
    font-weight: 600;
}

.invite-tier-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 10px;
    line-height: 1.45;
}

@media (max-width: 1200px) {
    .dashboard-bottom-row {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-bottom-row > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 992px) {
    .storage-row,
    .dashboard-chart-row,
    .dashboard-bottom-row {
        grid-template-columns: 1fr;
    }

    .dashboard-bottom-row > :last-child {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .dashboard-chart-row .dashboard-chat {
        order: -1;
    }

    .storage-panel .panel__header {
        gap: 10px;
    }

    .storage-panel__toggle {
        cursor: pointer;
    }

    .storage-panel__hint,
    .storage-panel__chevron {
        display: block;
    }

    .storage-panel:not(.is-expanded) .panel__body {
        display: none;
    }

    .storage-panel:not(.is-expanded) .panel__header {
        border-bottom: none;
    }

    .storage-panel.is-expanded .storage-panel__chevron {
        transform: rotate(180deg);
    }

    .storage-actions .btn,
    .feed-buy__quick .btn {
        min-width: 100%;
    }
}
