/**
 * Dark Mode Styles
 * Smooth transitions and modern dark theme
 */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f6fa;
    --bg-tertiary: #ffffff;
    --text-primary: #1c1c28;
    --text-secondary: #526484;
    --text-muted: #8094ae;
    --border-color: #dbdfea;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --input-bg: #ffffff;
    --input-border: #dbdfea;
    --nav-bg: #111b21;
    --nav-active: #00a884;
}

[data-theme="dark"] {
    /* Whale Tracker / WhatsApp Style Color Palette */
    --bg-primary: #0b141a;
    --bg-secondary: #0b141a;
    --bg-tertiary: #202c33;

    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;

    --border-color: #222d34;

    /* Harmonized Component Styles */
    --card-bg: linear-gradient(135deg, #0f1923, #1a2d42);
    --card-bg-solid: #111b21;
    --card-shadow: rgba(0, 0, 0, 0.45);

    --item-bg: rgba(255, 255, 255, 0.04);
    --item-border: rgba(255, 255, 255, 0.06);
    --item-hover: rgba(255, 255, 255, 0.08);

    --input-bg: #2a3942;
    --input-border: transparent;
    --nav-bg: #111b21;
    --nav-active: #00a884;
}

/* Smooth transitions for theme changes */
body,
.card,
.nk-header,
.nk-sidebar,
.btn,
input,
textarea,
select,
.form-control,
.table,
.modal-content,
.dropdown-menu,
.nav-link {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Dark mode base styles - WhatsApp inspired */
.dark-mode {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Force override for common utility classes */
body.dark-mode .bg-white,
body.dark-mode .bg-light,
body.dark-mode .bg-lighter,
body.dark-mode .card,
body.dark-mode .card-header,
body.dark-mode .card-body,
body.dark-mode .card-footer {
    background: var(--card-bg) !important;
}

body.dark-mode .nk-tb-item {
    background: var(--item-bg) !important;
}

body.dark-mode .text-dark,
body.dark-mode .text-black,
body.dark-mode .text-muted,
body.dark-mode .text-soft,
body.dark-mode .sub-text,
body.dark-mode .lead-text,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode .title,
body.dark-mode .nk-block-title,
body.dark-mode .fw-black:not(.text-primary) {
    color: var(--text-primary) !important;
}

body.dark-mode .text-muted,
body.dark-mode .text-soft,
body.dark-mode .sub-text,
body.dark-mode span:not(.badge),
body.dark-mode p,
body.dark-mode em,
body.dark-mode i:not(.bi-share):not(.bi-megaphone-fill),
body.dark-mode .caption-text {
    color: var(--text-muted);
}

body.dark-mode strong,
body.dark-mode b,
body.dark-mode .fw-bold {
    color: var(--text-primary) !important;
}

/* Header dark mode adjustments */
body.dark-mode .nk-header,
body.dark-mode .nk-header.is-light,
body.dark-mode .header-main,
body.dark-mode .header-nav,
body.dark-mode .header-ticker {
    background: #0b141a !important;
    border-bottom: 2px solid var(--nav-active) !important;
    /* Elegant green line */
}

body.dark-mode .nk-header .icon,
body.dark-mode .nk-header .user-name,
body.dark-mode .nk-header .user-status:not(.text-primary) {
    color: var(--text-primary) !important;
}

body.dark-mode .nk-header .logo-link span {
    color: #ffffff !important;
}

body.dark-mode .header-tab {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-muted) !important;
}

body.dark-mode .header-tab.active {
    background: rgba(0, 168, 132, 0.15) !important;
    color: #00a884 !important;
    border-color: rgba(0, 168, 132, 0.3) !important;
}

/* Cards & Containers - Harmonized with Whale Tracker */
body.dark-mode .card,
body.dark-mode .card-bordered,
body.dark-mode .news-card,
body.dark-mode .whale-card,
body.dark-mode .signal-card,
body.dark-mode .gem-card,
body.dark-mode .job-card,
body.dark-mode .market-card,
body.dark-mode .event-item-link,
body.dark-mode .nk-block-head-content,
body.dark-mode .nk-sidebar-brand,
body.dark-mode .card-dashlite,
body.dark-mode [class*="card"] {
    background: var(--card-bg) !important;
    border-color: var(--item-border) !important;
    border-radius: 14px !important;
    color: var(--text-primary) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .card-inner,
body.dark-mode .card-header,
body.dark-mode .card-footer,
body.dark-mode .wa-item,
body.dark-mode .nk-tb-item,
body.dark-mode .wa-item-inner {
    background: var(--item-bg) !important;
    border: 1px solid var(--item-border) !important;
    border-radius: 10px !important;
    color: var(--text-primary) !important;
    margin-bottom: 8px !important;
    transition: all 0.2s ease !important;
}

body.dark-mode .nk-block-head-content h2,
body.dark-mode .nk-block-head-content h3,
body.dark-mode .nk-block-head-content .title {
    color: var(--text-primary) !important;
}

body.dark-mode .wa-item:hover,
body.dark-mode .event-item-link:hover {
    background: var(--item-hover) !important;
    border-color: rgba(0, 168, 132, 0.3) !important;
}

/* WhatsApp Style List Overrides */
body.dark-mode .wa-list {
    background-color: var(--bg-primary) !important;
}

body.dark-mode .wa-item {
    border-bottom-color: var(--border-color) !important;
}

body.dark-mode .wa-item:active {
    background-color: var(--bg-tertiary) !important;
}

body.dark-mode .wa-title {
    color: var(--text-primary) !important;
}

body.dark-mode .wa-snippet,
body.dark-mode .wa-time {
    color: var(--text-muted) !important;
}

body.dark-mode .wa-avatar {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
}

/* Sidebar */
body.dark-mode .nk-sidebar {
    background-color: var(--card-bg) !important;
    border-right-color: var(--border-color) !important;
}

body.dark-mode .nk-menu-link {
    color: var(--text-secondary) !important;
}

body.dark-mode .nk-menu-link:hover,
body.dark-mode .nk-menu-item.active>.nk-menu-link {
    background-color: rgba(0, 168, 132, 0.1) !important;
    color: var(--nav-active) !important;
}

/* Forms & Controls */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .form-control-wrap,
body.dark-mode input:not(.btn),
body.dark-mode textarea,
body.dark-mode select {
    background-color: var(--input-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Segmented Control & Tabs */
body.dark-mode .segmented-control {
    background-color: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
}

body.dark-mode .segmented-item.active {
    background-color: var(--nav-active) !important;
    color: #fff !important;
}

/* Specific Dimension Badges */
body.dark-mode .badge-dim.bg-primary,
body.dark-mode .bg-primary-dim {
    background-color: rgba(101, 118, 255, 0.15) !important;
    color: #6576ff !important;
}

/* Dividers & Borders */
body.dark-mode hr,
body.dark-mode .divider,
body.dark-mode .border,
body.dark-mode .border-top,
body.dark-mode .border-bottom,
body.dark-mode .border-start,
body.dark-mode .border-end {
    border-color: var(--border-color) !important;
}

/* Badges */
body.dark-mode .badge {
    background-color: var(--bg-tertiary) !important;
    border: 1px solid var(--item-border) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .badge.bg-primary {
    background-color: rgba(101, 118, 255, 0.15) !important;
    color: #6576ff !important;
    border-color: rgba(101, 118, 255, 0.3) !important;
}

body.dark-mode .badge.bg-success,
body.dark-mode .badge.bg-success-dim {
    background-color: rgba(30, 224, 172, 0.15) !important;
    color: #1ee0ac !important;
    border-color: rgba(30, 224, 172, 0.3) !important;
}

body.dark-mode .badge.bg-warning {
    background-color: rgba(244, 189, 14, 0.15) !important;
    color: #f4bd0e !important;
    border-color: rgba(244, 189, 14, 0.3) !important;
}

body.dark-mode .nk-block-des,
body.dark-mode .nk-sale-data .amount,
body.dark-mode .nk-sale-data .title {
    color: var(--text-primary) !important;
}

/* Bottom Nav Fix */
body.dark-mode .header-wrap {
    background-color: var(--bg-primary) !important;
}

/* Standardized Homepage Headers */
.section-head-wa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.section-title-wa {
    font-weight: 800;
    color: #364a63;
    margin: 0;
    font-size: 18px !important;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-all-link {
    font-size: 13px;
    color: #6576ff;
    text-decoration: none !important;
    font-weight: 700;
    transition: all 0.2s ease;
}

.view-all-link:hover {
    opacity: 0.8;
    transform: translateX(3px);
}

body.dark-mode .section-title-wa {
    color: var(--text-primary) !important;
}

body.dark-mode .view-all-link {
    color: #6576ff !important;
}

/* Mobile & Avatar Icon Visibility */
.wa-avatar i,
.wa-item-avatar-hex i,
.wa-item-avatar-hex em {
    color: #6576ff !important;
}

body.dark-mode .wa-avatar i,
body.dark-mode .wa-item-avatar-hex i,
body.dark-mode .wa-item-avatar-hex em {
    color: var(--nav-active) !important;
}

/* Fix for any remaining white backgrounds */
body.dark-mode div[style*="background:#fff"],
body.dark-mode div[style*="background-color:#fff"],
body.dark-mode div[style*="background:white"],
body.dark-mode div[style*="background-color:white"],
body.dark-mode section[style*="background:#fff"],
body.dark-mode section[style*="background-color:#fff"] {
    background: var(--card-bg) !important;
    border-color: var(--item-border) !important;
}

/* Whale Tracker Style Utility Components */
.wa-section-glass {
    border-radius: 14px;
    transition: all 0.3s ease;
}

body.dark-mode .wa-section-glass {
    background: var(--card-bg) !important;
    padding: 20px !important;
    border: 1px solid var(--item-border) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
}

.wa-glass-card {
    background: #fff;
    border: 1px solid #e5e9f2;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

body.dark-mode .wa-glass-card {
    background: var(--card-bg) !important;
    border-color: var(--item-border) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

.wa-item-link {
    text-decoration: none !important;
    display: block;
    transition: all 0.25s ease;
}

.wa-item-inner {
    padding: 16px;
    border-bottom: 1px solid #f5f6fa;
}

body.dark-mode .wa-item-inner {
    border-bottom-color: var(--item-border) !important;
}

.wa-item-link:last-child .wa-item-inner {
    border-bottom: none;
}

.wa-item-link:hover .wa-item-inner {
    background: rgba(101, 118, 255, 0.03);
}

body.dark-mode .wa-item-link:hover .wa-item-inner {
    background: var(--item-hover) !important;
}

.wa-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wa-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.wa-item-avatar-hex {
    width: 40px;
    height: 40px;
    background: #6576ff15;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6576ff;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.wa-item-info {
    min-width: 0;
}

.wa-item-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #364a63;
    margin-bottom: 2px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .wa-item-title {
    color: var(--text-primary) !important;
}

.wa-item-sub {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: #8094ae;
}

.wa-item-highlight {
    font-size: 12px;
    font-weight: 700;
    color: #1ee0ac;
}

body,
.card,
.nk-header,
.nk-sidebar,
.btn,
.form-control,
.table,
.modal-content,
.dropdown-menu,
.nav-link {
    transition: background-color 0.25s ease, color 0.15s ease, border-color 0.25s ease !important;
}

/* Dark mode toggle button icon color */
body.dark-mode #darkModeToggle i {
    color: #ffc107 !important;
}