/* ==========================================================================
   Borsa & Piyasa Trader Terminal - borsa-style.css
   Designed for Tolga Oktar Platform
   ========================================================================== */

:root {
    --bg-color: #020312;
    --card-bg: #0e111d;
    --card-header-bg: #141927;
    --card-border: #1e2538;
    --card-hover: #161c2e;
    --text-color: #ffffff;
    --text-muted: #94a3b8;
    --main-color: #18e2ff;
    --h1-color: #b0f9ff;
    
    --green-up: #10b981;
    --green-up-bg: rgba(16, 185, 129, 0.15);
    --red-down: #f43f5e;
    --red-down-bg: rgba(244, 63, 94, 0.15);
    --neutral-bg: rgba(148, 163, 184, 0.12);
    --gold-accent: #f59e0b;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: 'Quicksand', sans-serif;
    text-decoration: none;
    list-style: none;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation Styling */
header {
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #020312ee;
    backdrop-filter: blur(10px);
    padding: 14px 7%;
    border-bottom: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--h1-color);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.navbar a,
.nav-dropdown-toggle {
    border: 1px solid transparent;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    transition: all 0.3s ease;
}

.nav-dropdown-toggle { display: flex; align-items: center; gap: 3px; background: transparent; cursor: pointer; font-family: inherit; }
.nav-dropdown-toggle i { font-size: 1rem; }

.navbar a:hover, .navbar a.active,
.nav-dropdown-toggle:hover, .nav-dropdown-toggle.active {
    border-color: var(--main-color);
    color: var(--text-color);
    background: rgba(24, 226, 255, 0.08);
}

.nav-dropdown { position: relative; }
.nav-submenu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 165px; padding: 7px; background: #0e111d; border: 1px solid var(--card-border); border-radius: 0.6rem; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .2s ease; }
.nav-dropdown:hover .nav-submenu,
.nav-dropdown:focus-within .nav-submenu,
.nav-dropdown.open .nav-submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.navbar .nav-submenu a { display: block; padding: 8px 10px; font-size: 0.84rem; white-space: nowrap; }

#menu-icon {
    font-size: 32px;
    color: var(--text-color);
    cursor: pointer;
    display: none;
}

/* Main Container Layout */
.terminal-container {
    margin-top: 75px;
    padding: 20px 4% 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Market Status Banner */
.market-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    flex-wrap: wrap;
    gap: 10px;
}

.market-status-bar.closed {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: #fca5a5;
}

.market-status-bar.open {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

.status-badge {
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.status-badge.red {
    background: rgba(244, 63, 94, 0.2);
    color: var(--red-down);
}

.status-badge.green {
    background: rgba(16, 185, 129, 0.2);
    color: var(--green-up);
}

.status-badge.yellow {
    background: rgba(245, 158, 11, 0.2);
    color: var(--gold-accent);
}

.status-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Top Live Ticker Bar */
.ticker-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 18px;
    overflow-x: auto;
}

.ticker-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.ticker-item:last-child {
    border-right: none;
}

.ticker-symbol {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ticker-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.ticker-change {
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 4px;
    padding: 2px 6px;
    width: fit-content;
}

.ticker-change.up {
    color: var(--green-up);
    background: var(--green-up-bg);
}

.ticker-change.down {
    color: var(--red-down);
    background: var(--red-down-bg);
}

/* Main Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

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

.main-column, .side-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Cards Design System */
.terminal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: border-color 0.3s ease;
}

.terminal-card:hover {
    border-color: rgba(24, 226, 255, 0.3);
}

.card-header {
    background: var(--card-header-bg);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--card-border);
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--h1-color);
}

.card-title i {
    font-size: 1.3rem;
    color: var(--main-color);
}

.card-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input {
    background: #020312;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--text-color);
    font-size: 0.85rem;
    outline: none;
    width: 160px;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--main-color);
    width: 200px;
}

.btn-filter {
    background: #020312;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-filter:hover, .btn-filter.active {
    background: rgba(24, 226, 255, 0.15);
    border-color: var(--main-color);
    color: var(--main-color);
}

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Quick Symbol Switcher Pill Buttons */
.symbol-quick-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.sym-btn {
    background: #141824;
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sym-btn:hover, .sym-btn.active {
    background: var(--main-color);
    color: #020312;
    border-color: var(--main-color);
}

/* TradingView Chart Container */
.chart-container {
    width: 100%;
    height: 440px;
    border-radius: 10px;
    overflow: hidden;
    background: #000000;
}

/* Tables Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.data-table th {
    background: #121724;
    color: var(--text-muted);
    padding: 12px 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--card-hover);
}

.stock-badge {
    display: flex;
    flex-direction: column;
}

.stock-symbol {
    font-weight: 700;
    color: var(--text-color);
}

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

.institution-name {
    font-weight: 600;
    color: #cbd5e1;
}

.rating-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-block;
}

.rating-buy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green-up);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.rating-hold {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gold-accent);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.rating-sell {
    background: rgba(244, 63, 94, 0.15);
    color: var(--red-down);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.upside-pot {
    font-weight: 700;
    color: var(--green-up);
}

/* Economic Calendar */
.calendar-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.calendar-live-badge {
    color: var(--green-up);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.calendar-live-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--green-up);
}

.economic-calendar-widget {
    width: 100%;
    min-height: 420px;
    overflow: hidden;
    border-radius: 8px;
}

.economic-calendar-widget .tradingview-widget-copyright {
    font-size: 0.68rem;
    text-align: right;
    padding-top: 4px;
}

/* KAP News & Market Feed */
.kap-range { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; margin-bottom: 8px; }
.kap-list { display: flex; flex-direction: column; max-height: 455px; overflow-y: auto; padding-right: 3px; }
.kap-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) 18px; gap: 10px; align-items: start; padding: 10px 4px; color: var(--text-color); border-bottom: 1px solid var(--card-border); transition: background 0.2s ease; }
.kap-item:hover { background: rgba(24, 226, 255, 0.04); }
.kap-date-time { display: flex; flex-direction: column; }
.kap-date-time time { color: var(--main-color); font-size: 0.8rem; font-weight: 700; }
.kap-date-time span { color: var(--text-muted); font-size: 0.68rem; }
.kap-content { min-width: 0; }
.kap-company-line { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.kap-company-line strong { color: var(--text-color); font-size: 0.82rem; }
.kap-company-line span { color: var(--text-muted); font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kap-type { color: var(--gold-accent); font-size: 0.7rem; font-weight: 600; margin-top: 2px; }
.kap-subject { font-size: 0.78rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kap-open-icon { color: var(--text-muted); font-size: 0.9rem; margin-top: 3px; }
.kap-item:hover .kap-open-icon { color: var(--main-color); }
.kap-all-link { display: flex; justify-content: flex-end; align-items: center; gap: 3px; color: var(--main-color); font-size: 0.76rem; font-weight: 700; margin-top: 10px; }
.kap-state { color: var(--text-muted); font-size: 0.8rem; padding: 14px 4px; }
.kap-error { color: var(--gold-accent); }

@media (max-width: 560px) {
    .kap-list { max-height: 390px; }
    .kap-item { grid-template-columns: 43px minmax(0, 1fr) 16px; gap: 7px; padding: 9px 2px; }
    .kap-company-line span { display: none; }
    .kap-type, .kap-subject { display: inline; }
    .kap-type::after { content: ' · '; color: var(--text-muted); }
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.news-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.news-tag {
    background: rgba(24, 226, 255, 0.15);
    color: var(--main-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.news-time {
    color: var(--text-muted);
}

.news-headline {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.35;
    transition: color 0.2s ease;
    cursor: pointer;
}

.news-headline:hover {
    color: var(--main-color);
}

/* Net Capital Flow & Foreign Ratio Summary */
.flow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.flow-box {
    background: #121724;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flow-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flow-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.flow-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
}

.flow-row span:first-child {
    font-weight: 700;
}

/* Trader Calculator Tools */
.calc-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.form-group input {
    background: #090c15;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text-color);
    font-size: 0.88rem;
    outline: none;
    font-weight: 700;
}

.form-group input:focus {
    border-color: var(--main-color);
}

.calc-result-box {
    grid-column: 1 / -1;
    background: rgba(24, 226, 255, 0.06);
    border: 1px dashed var(--main-color);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.res-item {
    text-align: center;
}

.res-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.res-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--main-color);
    margin-top: 2px;
}

/* Footer Styling */
footer {
    margin-top: auto;
    background: #020312;
    border-top: 1px solid var(--card-border);
    padding: 24px 8%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive Navigation */
@media (max-width: 830px) {
    #menu-icon {
        display: block;
    }

    .navbar {
        position: absolute;
        top: -600px;
        right: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        background: #0e111d;
        text-align: left;
        padding: 15px;
        border-bottom: 1px solid var(--card-border);
        transition: all 0.4s ease;
        gap: 0;
    }

    .navbar .nav-dropdown-toggle { width: 100%; justify-content: flex-start; padding: 1rem; }
    .navbar .nav-submenu { position: static; opacity: 1; visibility: visible; transform: none; border: 0; background: transparent; padding: 0 1rem 0.5rem 1.5rem; }
    .navbar .nav-submenu a { padding: 0.65rem 1rem; font-size: 0.86rem; }

    .navbar.active {
        top: 100%;
    }

    .terminal-container {
        padding: 15px 2% 30px;
    }
}

/* Modal Popup Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 3, 18, 0.88);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    background: var(--card-header-bg);
    padding: 18px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--h1-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i {
    font-size: 1.4rem;
    color: var(--main-color);
}

.modal-body {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 0.88rem;
    line-height: 1.65;
    color: #cbd5e1;
}

.modal-body p {
    color: #94a3b8;
}

.modal-footer {
    padding: 16px 24px;
    background: var(--card-header-bg);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
}

.btn-accept {
    background: linear-gradient(135deg, #18e2ff, #00b4d8);
    color: #020312;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(24, 226, 255, 0.3);
}

.btn-accept:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 22px rgba(24, 226, 255, 0.45);
}
