:root {
    --primary-color: #2563eb;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --background-color: #0f172a;
    --card-background: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success-color: #34d399;
    --danger-color: #f87171;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

/* Full Width Container */
.container {
    max-width: 98%;
    margin: 0 auto;
}

/* App Header - Single Row Layout */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    gap: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    /* Push to right */
    min-width: 0;
}

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

.badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.meta-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
}

.count-badge {
    background: #e2e8f0;
    color: #475569;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}

.time-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    font-family: monospace;
}

.clock-badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    font-family: monospace;
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 8px;
}

.user-email {
    font-size: 0.85rem;
    color: #475569;
    font-weight: 500;
}

.admin-badge {
    background: #dc2626;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.sub-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Divider for visual separation */
.divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 5px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: #1d4ed8;
}

.btn.secondary {
    background-color: #e2e8f0;
    color: #1e293b;
}

.btn.secondary:hover {
    background-color: #cbd5e1;
}

.text-btn {
    background: none;
    border: none;
    color: #64748b;
    text-decoration: underline;
    cursor: pointer;
    padding: 0 10px;
}

.search-box input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    width: 200px;
}

/* Selected Row Styles */
tr.selected td {
    background-color: #e0f2fe !important;
    /* Light blue highlight */
}

tr.selected td:first-child {
    border-left: 3px solid var(--primary-color);
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    animation: fadeIn 0.3s ease;
    margin-right: auto;
}

.selected-label {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Link Style for Stock Symbol */
.stock-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.symbol-cell-content {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-start;
}

.row-quick-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 2px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

tr:hover .row-quick-actions,
tr.selected .row-quick-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.row-mini-btn {
    width: 20px;
    height: 20px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    background: #ffffff;
    color: #334155;
}

.row-mini-btn:hover {
    background: #f1f5f9;
}

.row-mini-g {
    color: #4f46e5;
    border-color: #a5b4fc;
}

.row-mini-b {
    color: #0f766e;
    border-color: #99f6e4;
}

.row-mini-t {
    color: #1d4ed8;
    border-color: #93c5fd;
}

.row-mini-r {
    color: #dc2626;
    border-color: #fca5a5;
}

.stock-link:hover {
    text-decoration: underline;
}

.stock-name-link {
    cursor: pointer;
}

/* Table Container with Sticky Headers & Visible Scrollbar */
.table-container {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    /* Key for visible scrollbar */
    overflow: auto;
    max-height: calc(100vh - 180px);
    /* Adjust based on header height */
    position: relative;
}

#watchlistContainer {
    height: auto;
    max-height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
}

.table-resize-handle {
    height: 7px;
    cursor: row-resize;
    background: transparent;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    margin: 0 4px 2px 4px;
    border-radius: 0 0 4px 4px;
    transition: background 0.15s, border-color 0.15s;
}

.table-resize-handle:hover,
.table-resize-handle.dragging {
    background: rgba(99, 102, 241, 0.12);
    border-bottom-color: #6366f1;
}

body.resizing-table {
    -webkit-user-select: none;
    user-select: none;
    cursor: row-resize;
}

#watchNoteInput {
    width: 100%;
    resize: vertical;
    min-height: 44px;
    font-family: inherit;
    font-size: 0.75rem;
}

.mini-clear-btn {
    padding: 2px 8px;
    font-size: 0.68rem;
    line-height: 1.2;
    display: block;
    width: 100%;
    margin-bottom: 2px;
}

.son-donem-btn {
    margin-bottom: 0;
}

.son-donem-btn.active {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

.ui-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #0f172a;
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ui-toast.show {
    opacity: 0.95;
    transform: translateX(-50%) translateY(0);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#stockTable,
#watchlistTable {
    table-layout: fixed;
}

/* Column widths: Hisse | Fiyat | Değişim | OzEder | %OzEder | TopEder | %TopEder | ReelEder | %ReelEder | R_Hcm | Borc/OzV | NetK/OzV | FaalK/OzV | BrutK/OzV | F/K | PD/DD | Dönem */
#stockColgroup col:nth-child(1),
#watchlistColgroup col:nth-child(1) {
    width: 8%;
}

#stockColgroup col:nth-child(2),
#watchlistColgroup col:nth-child(2) {
    width: 5%;
}

#stockColgroup col:nth-child(3),
#watchlistColgroup col:nth-child(3) {
    width: 6%;
}

#stockColgroup col:nth-child(n+4):nth-child(-n+16),
#watchlistColgroup col:nth-child(n+4):nth-child(-n+16) {
    width: 5.8%;
}

#stockColgroup col:nth-child(17),
#watchlistColgroup col:nth-child(17) {
    width: 5%;
}

/* Compact Cells */
th,
td {
    padding: 3px 4px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.72rem;
    white-space: nowrap;
}

/* Headers can wrap to save width */
th {
    white-space: normal;
    vertical-align: bottom;
    line-height: 1.2;
    text-align: right;
    /* Match data alignment */
}

/* Specific alignment for Symbol - First Column Sticky */
td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: var(--card-background);
}

th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
}

/* Sticky Headers */
thead {
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: #f1f5f9;
}

/* Fix for sticky header background - Sort Row */
thead tr:first-child th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 0 var(--border-color);
    cursor: pointer;
    height: 32px;
}

/* Sort direction indicators */
th.sort-asc::after,
th.sort-desc::after {
    margin-left: 3px;
    font-size: 0.6rem;
    opacity: 0.7;
}

th.sort-asc::after {
    content: '▲';
}

th.sort-desc::after {
    content: '▼';
}

/* Filter Row - Sticky below Sort Row */
thead tr.filter-row th {
    position: sticky;
    top: 32px;
    /* Height of first header row */
    z-index: 29;
    background-color: #f8fafc;
    box-shadow: 0 1px 0 var(--border-color);
    cursor: default;
}

/* Sticky First Column - Higher z-index for corner overlap */
thead tr:first-child th:first-child {
    z-index: 40 !important;
    /* Highest to stay on top of everything */
    background-color: #f1f5f9 !important;
    left: 0;
}

thead tr.filter-row th:first-child {
    z-index: 39 !important;
    background-color: #f8fafc !important;
    left: 0;
}

tbody td:first-child {
    background-color: var(--card-background) !important;
    font-weight: 600;
    z-index: 10;
}

tr:hover td:first-child {
    background-color: #f8fafc !important;
}

tbody td:first-child {
    background-color: var(--card-background);
    font-weight: 600;
    z-index: 21;
}

tr:hover td:first-child {
    background-color: #f8fafc;
}

tr:hover {
    background-color: #f8fafc;
}

.text-right {
    text-align: right;
}

.text-green {
    color: var(--success-color);
    font-weight: 600;
}

.text-red {
    color: var(--danger-color);
    font-weight: 600;
}

.text-blue {
    color: #2563eb;
    font-weight: 600;
}

.loading-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Inline Filters */
.filter-input {
    width: 100%;
    min-width: 40px;
    /* Narrower */
    padding: 2px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    font-size: 0.7rem;
    display: block;
    /* Stack them */
    margin-bottom: 2px;
}

/* ===== MAIN LAYOUT: Table + Right Panel ===== */
.main-layout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.table-area {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
}

/* ===== RIGHT PANEL ===== */
.right-panel {
    width: 180px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 20px;
}

/* Panel Widget Container */
.panel-widget {
    background: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 14px;
    border: 1px solid var(--border-color);
}

.widget-title {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Market Movement Section (compact, below indices) */
.market-movement-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* Market Summary Buttons */
.market-summary-buttons {
    display: flex;
    flex-direction: row;
    gap: 6px;
}

.summary-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 2px;
    padding: 6px 4px;
    border: 1.5px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.summary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.summary-btn.active {
    border-width: 2px;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Rising */
.summary-btn.rising {
    color: #059669;
    background: #ecfdf5;
}

.summary-btn.rising:hover,
.summary-btn.rising.active {
    background: #d1fae5;
    border-color: #10b981;
}

/* Unchanged */
.summary-btn.unchanged {
    color: #6b7280;
    background: #f3f4f6;
}

.summary-btn.unchanged:hover,
.summary-btn.unchanged.active {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Falling */
.summary-btn.falling {
    color: #dc2626;
    background: #fef2f2;
}

.summary-btn.falling:hover,
.summary-btn.falling.active {
    background: #fee2e2;
    border-color: #ef4444;
}

.summary-icon {
    font-size: 0.7rem;
    line-height: 1;
}

.summary-count {
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
}

/* Market Ratio Bar */
.market-ratio-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0 4px 0;
    background: #e5e7eb;
}

.ratio-rising {
    background: linear-gradient(90deg, #10b981, #34d399);
    transition: width 0.5s ease;
}

.ratio-unchanged {
    background: #9ca3af;
    transition: width 0.5s ease;
}

.ratio-falling {
    background: linear-gradient(90deg, #f87171, #ef4444);
    transition: width 0.5s ease;
}

/* Ratio Labels */
.ratio-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    font-weight: 700;
}

.text-muted {
    color: #6b7280;
}

/* ===== FOOTER ===== */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    color: #94a3b8;
    font-size: 0.72rem;
    margin-top: 8px;
}

.app-footer span:first-child {
    font-style: italic;
}

.footer-credit {
    font-weight: 500;
    color: #64748b;
}

/* Panel Actions */
.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.full-width {
    width: 100%;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Search Input inside Filter Row */
.search-input {
    width: 50%;
    min-width: 50px;
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 1px solid var(--primary-color);
    background-color: #fff;
    font-weight: 500;
}

.search-input:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    outline: none;
}

/* Search Wrapper & Dropdown */
.search-wrapper {
    position: relative;
    width: 100%;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    max-height: 220px;
    /* ~10 satır */
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 9999;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.search-dropdown-item {
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    color: #1e3a5f;
    white-space: nowrap;
    border-bottom: 1px solid #f1f5f9;
}

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

.search-dropdown-item:hover,
.search-dropdown-item.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.search-dropdown-empty {
    padding: 6px 10px;
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
}

/* Stock Preview Popup Modal */
.stock-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-preview-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.stock-preview-modal-card {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(59, 130, 246, 0.08);
    width: 340px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    animation: previewPopIn 0.2s ease-out;
}

@keyframes previewPopIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.stock-preview-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.preview-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e3a5f;
    letter-spacing: 0.5px;
}

.preview-modal-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.preview-modal-actions .row-mini-btn {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.preview-modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    color: #94a3b8;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 4px;
    transition: all 0.15s;
}

.preview-modal-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.stock-preview-modal-body {
    padding: 0 16px 16px 16px;
}

/* Price highlight section */
.preview-grid-highlight {
    padding: 14px 0 12px 0;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 10px;
}

.preview-grid-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
}

.preview-grid-price-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.preview-grid-change {
    font-size: 0.95rem;
    font-weight: 700;
}

/* Data grid - 2 columns */
.preview-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.preview-grid-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: #ffffff;
}

.preview-grid-item:hover {
    background: #f8fafc;
}

.preview-grid-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.preview-grid-label.text-blue {
    color: #2563eb;
}

.preview-grid-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    text-align: right;
    white-space: nowrap;
}

.preview-grid-value.text-green {
    color: var(--success-color);
}

.preview-grid-value.text-red {
    color: var(--danger-color);
}

.preview-grid-value.text-blue {
    color: #2563eb;
}

/* User Info Widget */
.user-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.75rem;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.user-row .icon {
    font-size: 1rem;
    min-width: 18px;
    text-align: center;
}

.info-text {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

/* ===== PERIOD CHANGES WIDGET ===== */

.period-progress {
    margin: 10px 0;
}

.period-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.period-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.period-progress-text {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    display: block;
}

.period-results {
    margin-top: 8px;
}

.period-no-changes {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success-color);
    padding: 8px;
    background: #ecfdf5;
    border-radius: 6px;
}

.period-checked-at {
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.period-change-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: #d97706;
    background: #fffbeb;
    padding: 6px 8px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 8px;
}

.period-change-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.period-change-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.7rem;
    transition: all 0.3s ease;
}

.period-change-item.period-updated {
    background: #ecfdf5;
    border-color: #a7f3d0;
    opacity: 0.7;
}

/* Canlı akış: yeni bulunan değişiklik vurgu animasyonu */
.period-change-item.period-change-new {
    animation: periodNewFlash 1.5s ease;
}

@keyframes periodNewFlash {
    0% {
        background: #fef3c7;
        border-color: #f59e0b;
        transform: translateX(-4px);
    }

    50% {
        background: #fef9c3;
        border-color: #fbbf24;
    }

    100% {
        background: #f8fafc;
        border-color: var(--border-color);
        transform: translateX(0);
    }
}

.period-change-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.period-change-info strong {
    font-size: 0.72rem;
    color: var(--primary-color);
}

.period-arrow {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.period-update-btn {
    padding: 2px 6px !important;
    font-size: 0.7rem !important;
    min-width: 28px;
}

.period-bulk-actions {
    margin-top: 8px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-background);
    margin: 2% auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

/* Change Password Modal */
.change-password-modal-content {
    max-width: 400px;
    padding: 24px;
}

.cp-form-group {
    margin-bottom: 14px;
}

.cp-form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.cp-form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--card-background);
    color: var(--text-primary);
    box-sizing: border-box;
}

.cp-message {
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: none;
    font-size: 0.85rem;
}

.cp-message.error {
    display: block;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.cp-message.success {
    display: block;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.cp-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.cp-buttons .btn {
    flex: 1;
}

.modal-body {
    height: 600px;
    width: 100%;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Help Button */
.btn-help {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 4px;
}

.btn-help:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Guide Modal */
.guide-modal-content {
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
}

.guide-body {
    padding: 10px 0 0;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.guide-card {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    position: relative;
}

.guide-card-number {
    position: absolute;
    top: -10px;
    left: 14px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.guide-card h3 {
    margin: 4px 0 8px;
    font-size: 0.95rem;
    color: var(--primary-color);
}

.guide-card ul {
    margin: 0;
    padding-left: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.guide-card li {
    margin-bottom: 2px;
}

.guide-card strong {
    color: var(--text-primary);
}

.guide-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.guide-checkbox-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

    .guide-modal-content {
        margin: 5% auto;
        width: 95%;
    }
}

/* ===== Çoklu Grafik Modal ===== */
.multi-chart-modal-content {
    background: #131722;
    margin: 2vh auto;
    width: 94vw;
    height: 96vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #2a2e39;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.multi-chart-header {
    background: #1a1f2e;
    padding: 11px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #2a2e39;
    flex-shrink: 0;
}

.multi-chart-header h2 {
    color: #d1d4dc;
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
}

.multi-chart-info {
    color: #6b7a9a;
    font-size: 0.8rem;
    flex: 1;
}

.multi-chart-close-btn {
    background: none;
    border: none;
    color: #6b7a9a;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.15s;
}

.multi-chart-close-btn:hover {
    color: #d1d4dc;
}

.multi-chart-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 270px);
    gap: 10px;
    align-content: start;
}

.mc-price-canvas,
.mc-macd-canvas {
    display: block;
}

.multi-chart-footer {
    background: #1a1f2e;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #2a2e39;
    flex-shrink: 0;
}

.multi-chart-selected-info {
    color: #6b7a9a;
    font-size: 0.82rem;
    flex: 1;
}

/* Chart Cards */
.mc-card {
    background: #1a1f2e;
    border: 2px solid #2a2e39;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

.mc-card:hover {
    border-color: #3d4568;
}

.mc-card.mc-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.mc-card-header {
    display: flex;
    align-items: center;
    padding: 7px 10px 5px;
    gap: 5px;
    background: #1e2438;
}

.mc-star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    padding: 0 3px 0 0;
    line-height: 1;
    color: #3d4568;
    transition: color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.mc-star:hover {
    transform: scale(1.2);
}

.mc-star.mc-in-watchlist {
    color: #f59e0b;
}

.mc-symbol {
    font-weight: 700;
    font-size: 0.82rem;
    color: #d1d4dc;
    flex: 1;
    letter-spacing: 0.02em;
}

.mc-price-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.mc-price {
    font-size: 0.78rem;
    font-weight: 600;
    color: #c8cdd8;
}

.mc-change {
    font-size: 0.69rem;
    font-weight: 600;
}

.mc-change-pos {
    color: #26a69a;
}

.mc-change-neg {
    color: #ef5350;
}

.mc-change-neu {
    color: #6b7a9a;
}

.mc-price-chart-wrap {
    height: 170px !important;
    background: #131722;
    position: relative;
    overflow: hidden;
}

.mc-macd-chart-wrap {
    height: 75px !important;
    background: #0f111a;
    border-top: 1px solid #1e2438;
    position: relative;
    overflow: hidden;
}

.mc-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3d4568;
    font-size: 0.7rem;
    pointer-events: none;
}

.mc-watchlist-only-badge {
    font-size: 0.62rem;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .multi-chart-body {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .mc-price-chart-wrap {
        height: 130px;
    }

    .mc-macd-chart-wrap {
        height: 60px;
    }
}

/* ===== ENDEKS GÖSTERGELERİ ===== */
.indices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 0;
}

.indices-loading {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 8px 0;
}

.index-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 7px;
    border: 1px solid transparent;
    text-align: center;
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.index-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Yükselen — Yeşil */
.index-card.rising {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

/* Düşen — Kırmızı */
.index-card.falling {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* Değişmeyen — Gri */
.index-card.unchanged {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #374151;
}

.index-symbol {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    opacity: 0.85;
    line-height: 1;
}

/* Puan column styles */
.puan-cell {
    cursor: pointer;
}
.puan-override {
    font-style: italic;
    text-decoration: underline dotted;
}

/* Puan Formula Modal */
.puan-formula-modal-content {
    max-width: 480px;
}
.pf-body {
    padding: 4px 0;
}
.pf-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
}
.pf-header-row {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}
.pf-total-row {
    border-bottom: none;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 2px solid var(--border-color);
}
.pf-label {
    font-size: 0.82rem;
    color: var(--text-primary);
}
.pf-weight-label {
    font-size: 0.8rem;
    width: 64px;
    text-align: center;
}
.pf-input {
    width: 64px;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    background: var(--card-background);
    color: var(--text-primary);
}
.pf-input:focus {
    outline: none;
    border-color: #3b82f6;
}
.pf-total {
    width: 64px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.index-value {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
}

.index-change {
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0.9;
}

/* ===== DARK MODE OVERRIDES ===== */

/* Theme toggle button */
.theme-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    color: var(--text-secondary);
}
.theme-toggle-btn:hover {
    background: var(--background-color);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

/* Sub-badge variants (replacing inline styles) */
.sub-badge--override { background: #fef3c7; color: #92400e; }
.sub-badge--paid     { background: #d1fae5; color: #065f46; }
.sub-badge--trial    { background: #e0e7ff; color: #3730a3; }
.sub-badge--expired  { background: #fee2e2; color: #dc2626; }

[data-theme="dark"] .sub-badge--override { background: #1c1408; color: #fbbf24; }
[data-theme="dark"] .sub-badge--paid     { background: #022c22; color: #6ee7b7; }
[data-theme="dark"] .sub-badge--trial    { background: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .sub-badge--expired  { background: #450a0a; color: #fca5a5; }

/* Header / User area */
[data-theme="dark"] .user-info {
    background: #1e293b;
}
[data-theme="dark"] .user-email {
    color: #94a3b8;
}
[data-theme="dark"] .count-badge {
    background: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .time-badge {
    background: #1c1408;
    color: #fbbf24;
}
[data-theme="dark"] .clock-badge {
    background: #1e3a8a;
    color: #93c5fd;
}
[data-theme="dark"] .badge {
    background: #1e3a8a;
    color: #93c5fd;
}
[data-theme="dark"] .selection-actions {
    background: #1e293b;
}

/* Buttons */
[data-theme="dark"] .btn.secondary {
    background-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .btn.secondary:hover {
    background-color: #475569;
}
[data-theme="dark"] .text-btn {
    color: #94a3b8;
}
[data-theme="dark"] .search-input {
    background-color: #1e293b;
    color: #e2e8f0;
}

/* Table: thead */
[data-theme="dark"] thead {
    background-color: #1e293b;
}
[data-theme="dark"] thead tr:first-child th {
    background-color: #1e293b;
}
[data-theme="dark"] thead tr:first-child th:first-child {
    background-color: #1e293b !important;
}
[data-theme="dark"] thead tr.filter-row th {
    background-color: #0f172a;
}
[data-theme="dark"] thead tr.filter-row th:first-child {
    background-color: #0f172a !important;
}

/* Table: tbody hover, selection */
[data-theme="dark"] tr:hover {
    background-color: #1e293b;
}
[data-theme="dark"] tr:hover td:first-child {
    background-color: #1e293b !important;
}
[data-theme="dark"] tr.selected td {
    background-color: #1e3a8a !important;
}

/* Filter input */
[data-theme="dark"] .filter-input {
    border-color: #475569;
    background: #0f172a;
    color: #e2e8f0;
}

/* Row mini buttons */
[data-theme="dark"] .row-mini-btn {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
}
[data-theme="dark"] .row-mini-btn:hover {
    background: #334155;
}

/* Search dropdown */
[data-theme="dark"] .search-dropdown {
    background: #1e293b;
    border-color: #475569;
}
[data-theme="dark"] .search-dropdown-item {
    color: #93c5fd;
    border-bottom-color: #334155;
}
[data-theme="dark"] .search-dropdown-item:hover,
[data-theme="dark"] .search-dropdown-item.active {
    background: #1e3a8a;
    color: #bfdbfe;
}

/* Stock Preview Modal */
[data-theme="dark"] .stock-preview-modal-card {
    background: #1e293b;
}
[data-theme="dark"] .stock-preview-modal-header {
    border-bottom-color: #334155;
}
[data-theme="dark"] .preview-modal-title {
    color: #93c5fd;
}
[data-theme="dark"] .preview-grid-highlight {
    border-bottom-color: #334155;
}
[data-theme="dark"] .preview-grid-price-value {
    color: #e2e8f0;
}
[data-theme="dark"] .preview-data-grid {
    background: #334155;
    border-color: #475569;
}
[data-theme="dark"] .preview-grid-item {
    background: #1e293b;
}
[data-theme="dark"] .preview-grid-item:hover {
    background: #0f172a;
}
[data-theme="dark"] .preview-grid-label {
    color: #94a3b8;
}
[data-theme="dark"] .preview-grid-value {
    color: #e2e8f0;
}
[data-theme="dark"] .preview-modal-close-btn:hover {
    background: #450a0a;
    color: #f87171;
}

/* Toast */
[data-theme="dark"] .ui-toast {
    background: #f1f5f9;
    color: #0f172a;
}

/* Summary buttons (market movement) */
[data-theme="dark"] .summary-btn {
    background: #0f172a;
}
[data-theme="dark"] .summary-btn.rising {
    color: #34d399;
    background: #022c22;
}
[data-theme="dark"] .summary-btn.rising:hover,
[data-theme="dark"] .summary-btn.rising.active {
    background: #064e3b;
    border-color: #34d399;
}
[data-theme="dark"] .summary-btn.unchanged {
    color: #9ca3af;
    background: #1f2937;
}
[data-theme="dark"] .summary-btn.unchanged:hover,
[data-theme="dark"] .summary-btn.unchanged.active {
    background: #374151;
    border-color: #6b7280;
}
[data-theme="dark"] .summary-btn.falling {
    color: #f87171;
    background: #450a0a;
}
[data-theme="dark"] .summary-btn.falling:hover,
[data-theme="dark"] .summary-btn.falling.active {
    background: #7f1d1d;
    border-color: #f87171;
}

/* Market ratio bar */
[data-theme="dark"] .market-ratio-bar {
    background: #374151;
}

/* Index cards */
[data-theme="dark"] .index-card.rising {
    background: #022c22;
    border-color: #064e3b;
    color: #6ee7b7;
}
[data-theme="dark"] .index-card.falling {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}
[data-theme="dark"] .index-card.unchanged {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

/* Period changes widget */
[data-theme="dark"] .period-change-item {
    background: #0f172a;
}
[data-theme="dark"] .period-change-item.period-updated {
    background: #022c22;
    border-color: #064e3b;
}
[data-theme="dark"] .period-change-header {
    background: #1c1408;
    color: #fbbf24;
}
[data-theme="dark"] .period-no-changes {
    background: #022c22;
}
[data-theme="dark"] .period-progress-bar {
    background: #374151;
}

/* Change password modal messages */
[data-theme="dark"] .cp-message.error {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}
[data-theme="dark"] .cp-message.success {
    background: #022c22;
    color: #6ee7b7;
    border-color: #064e3b;
}

/* Guide card */
[data-theme="dark"] .guide-card {
    background: #0f172a;
}

/* Puan formula modal */
[data-theme="dark"] .pf-input {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

/* Son donem button */
[data-theme="dark"] .son-donem-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* Mini clear button */
[data-theme="dark"] .mini-clear-btn {
    background: #334155;
    color: #e2e8f0;
}

/* Scrollbar for dark mode */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f172a;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}