/* ═══════════════════════════════════════════════
   NERON TRADER — Settings & Notifications Modals
   ═══════════════════════════════════════════════ */

/* ── Generic Modal Backdrop ── */
.neron-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.neron-modal-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Generic Modal Container ── */
.neron-modal {
    position: fixed;
    z-index: 601;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}
.neron-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Desktop: centered modal */
@media (min-width: 769px) {
    .neron-modal {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -48%);
        border-radius: var(--radius-xl);
        max-height: 80vh;
        width: 480px;
    }
    .neron-modal.visible {
        transform: translate(-50%, -50%);
    }
    .neron-modal.modal-notifications {
        width: 440px;
        right: 60px;
        left: auto;
        top: 52px;
        transform: translateY(-8px);
        max-height: calc(100vh - 64px);
    }
    .neron-modal.modal-notifications.visible {
        transform: translateY(0);
    }
}

/* Mobile: bottom sheet */
@media (max-width: 768px) {
    .neron-modal {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        transform: translateY(100%);
        padding-bottom: var(--sa-bottom);
    }
    .neron-modal.visible {
        transform: translateY(0);
    }

    /* Modal header — grab handle */
    .neron-modal-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--bg-active);
    }
    .neron-modal-header {
        position: relative;
        padding-top: 18px;
    }

    /* Settings — daha kompakt */
    .settings-section {
        padding: 12px 14px;
    }
    .settings-row {
        padding: 8px 0;
    }
    .settings-row-label {
        font-size: 13px;
    }
    .settings-select {
        min-width: 80px;
        font-size: 12px;
    }
    .settings-input {
        font-size: 14px; /* iOS zoom prevention */
        padding: 10px 12px;
    }

    /* Notifications — kompakt tab'lar */
    .notif-tabs {
        padding: 6px 10px 0;
        gap: 0;
    }
    .notif-tab {
        padding: 6px 8px;
        font-size: 11px;
    }
    .notif-actions {
        padding: 5px 10px;
    }
    .notif-item {
        padding: 10px 12px;
    }
    .notif-title {
        font-size: 12px;
    }
    .notif-time {
        font-size: 10px;
    }

    /* Notification badge — toolbar uyumu */
    .toolbar-notif-badge {
        top: -1px;
        right: -2px;
        min-width: 12px;
        height: 12px;
        font-size: 8px;
        padding: 0 2px;
    }
}

/* ── Modal Header ── */
.neron-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.neron-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.neron-modal-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-hover);
    border-radius: 50%;
    font-size: 17px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition);
}
.neron-modal-close:hover { background: var(--bg-active); }
.neron-modal-close:active { transform: scale(0.92); }

/* ── Modal Body ── */
.neron-modal-body {
    overflow-y: auto;
    overscroll-behavior-y: contain;
    flex: 1;
    padding: 0;
}

/* ═══════════════════════════
   SETTINGS MODAL
   ═══════════════════════════ */

/* Section */
.settings-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-child {
    border-bottom: none;
}
.settings-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Settings Row */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    gap: 12px;
}
.settings-row + .settings-row {
    border-top: 1px solid var(--border);
}
.settings-row-label {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
}
.settings-row-value {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}
.settings-row-action {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: color var(--transition);
}
.settings-row-action:hover { color: var(--accent-hover); }

/* Toggle Switch */
.settings-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.settings-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-active);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.settings-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: transform 0.2s;
}
.settings-toggle input:checked + .settings-toggle-slider {
    background: var(--accent);
}
.settings-toggle input:checked + .settings-toggle-slider::before {
    transform: translateX(18px);
}

/* Select Dropdown */
.settings-select {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 12px;
    padding: 5px 8px;
    cursor: pointer;
    outline: none;
    min-width: 90px;
}
.settings-select:focus {
    border-color: var(--accent);
}

/* Inline Form (username/password edit) */
.settings-inline-form {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    animation: settingsFadeIn 0.2s ease;
}
.settings-inline-form.visible {
    display: flex;
}
.settings-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
}
.settings-input:focus {
    border-color: var(--accent);
}
.settings-input::placeholder {
    color: var(--text-muted);
}
.settings-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.settings-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.settings-btn-primary {
    background: var(--accent);
    color: #fff;
}
.settings-btn-primary:hover { background: var(--accent-hover); }
.settings-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.settings-btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.settings-btn-secondary:hover { background: var(--bg-active); }

/* Status Chip */
.settings-chip {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.settings-chip-vip {
    background: var(--yellow-bg);
    color: var(--yellow);
}
.settings-chip-free {
    background: var(--green-bg);
    color: var(--green);
}
.settings-chip-none {
    background: var(--red-bg);
    color: var(--red);
}

/* Exchange info */
.settings-exchange-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
}
.settings-exchange-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}
.settings-exchange-dot.inactive {
    background: var(--text-muted);
}

/* Error/Success message */
.settings-msg {
    font-size: 11px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-top: 4px;
}
.settings-msg-error {
    background: var(--red-bg);
    color: var(--red);
}
.settings-msg-success {
    background: var(--green-bg);
    color: var(--green);
}

/* Theme Grid */
.settings-theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 4px 0 6px;
}
.settings-theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px 8px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.settings-theme-btn:active {
    transform: scale(0.95);
}
.settings-theme-btn.active {
    border-color: var(--accent);
    background: var(--accent-muted);
}
.settings-theme-icon {
    font-size: 20px;
    line-height: 1;
}
.settings-theme-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.settings-theme-btn.active .settings-theme-label {
    color: var(--accent);
}
@media (max-width: 768px) {
    .settings-theme-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .settings-theme-btn {
        padding: 8px 2px 6px;
    }
    .settings-theme-icon {
        font-size: 18px;
    }
    .settings-theme-label {
        font-size: 9px;
    }
}

@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════
   NOTIFICATIONS MODAL
   ═══════════════════════════ */

/* Notification Tabs */
.notif-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 12px 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
}
.notif-tab {
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all var(--transition);
    position: relative;
}
.notif-tab:hover { color: var(--text-secondary); }
.notif-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.notif-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    margin-left: 4px;
    background: var(--accent-muted);
    color: var(--accent);
}
.notif-tab.active .notif-tab-badge {
    background: var(--accent);
    color: #fff;
}

/* Notification Actions Bar */
.notif-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.notif-action-btn {
    font-size: 11px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.notif-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.notif-action-btn.danger:hover {
    color: var(--red);
    background: var(--red-bg);
}

/* Notification List */
.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread {
    background: var(--accent-muted);
}
.notif-item.unread:hover {
    background: rgba(108, 92, 231, 0.12);
}

/* Notification Icon */
.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.notif-icon img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.notif-icon-signal { background: var(--green-bg); color: var(--green); }
.notif-icon-signal.short { background: var(--red-bg); color: var(--red); }
.notif-icon-market { background: var(--yellow-bg); color: var(--yellow); }
.notif-icon-system { background: var(--bg-hover); color: var(--text-muted); }
.notif-icon-announcement { background: var(--blue-bg); color: var(--blue); }

/* Notification Content */
.notif-content {
    flex: 1;
    min-width: 0;
}
.notif-title {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-item.unread .notif-title {
    font-weight: 600;
}
.notif-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Unread dot */
.notif-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 4px;
}

/* Empty State */
.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
}
.notif-empty svg {
    width: 40px;
    height: 40px;
    opacity: 0.4;
    margin-bottom: 12px;
}
.notif-empty-text {
    font-size: 13px;
}

/* Notification Loading */
.notif-loading {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

/* ── Toolbar Notification Badge ── */
.toolbar-notif-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 7px;
    background: var(--red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}
.toolbar-notif-badge:empty,
.toolbar-notif-badge[data-count="0"] {
    display: none;
}

/* Toolbar button position fix for badge */
#notificationsBtn {
    position: relative;
}

/* ── Delete Confirm Dialog ── */
.notif-confirm-dialog {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    animation: slideUp 0.2s ease;
}
.notif-confirm-text {
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
}
.notif-confirm-actions {
    display: flex;
    gap: 8px;
}
.notif-confirm-actions .settings-btn {
    flex: 1;
}
.settings-btn-danger {
    background: var(--red);
    color: #fff;
}
.settings-btn-danger:hover { background: #e82f5e; }

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ═══════════════════════════
   GLASS THEME OVERRIDES
   ═══════════════════════════ */
[data-theme="glass"] .neron-modal,
[data-theme="glass-green"] .neron-modal,
[data-theme="glass-purple"] .neron-modal,
[data-theme="glass-amber"] .neron-modal,
[data-theme="glass-carbon"] .neron-modal {
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-color: rgba(255, 255, 255, 0.12);
}
