/* ==========================================================================
   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: 16px 8%;
    border-bottom: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

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

.navbar {
    display: flex;
    gap: 0.5rem;
}

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

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

#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 Feed */
.calendar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.calendar-item {
    background: #121724;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.calendar-item:hover {
    border-color: rgba(24, 226, 255, 0.4);
    transform: translateX(3px);
}

.cal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cal-flag {
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-color);
}

.cal-time {
    font-size: 0.8rem;
    color: var(--main-color);
    font-weight: 700;
    background: rgba(24, 226, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.cal-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
}

.cal-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: #090c15;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    text-align: center;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.72rem;

}

.metric-val {
    font-weight: 700;
    color: var(--text-color);
    margin-top: 2px;
}

.impact-high {
    color: var(--red-down);
}
.impact-med {
    color: var(--gold-accent);
}
.impact-low {
    color: var(--green-up);
}

/* KAP News & Market Feed */
.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;
    }

    .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);
}
