/* =============================================================================
   REACT-STYLE MODERN DASHBOARD UI
   Material Design + Glassmorphism + Micro-interactions
   ============================================================================= */

/* =============================================================================
   ENHANCED CSS VARIABLES
   ============================================================================= */
:root {
    /* Dashboard-specific colors */
    --dash-bg: #060b18;
    --dash-surface: rgba(15, 23, 42, 0.65);
    --dash-surface-hover: rgba(30, 41, 59, 0.75);
    --dash-surface-active: rgba(30, 58, 95, 0.55);
    --dash-gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --dash-gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --dash-gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --dash-gradient-info: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --dash-gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --dash-gradient-amber: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --dash-gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    
    /* Sidebar */
    --sidebar-bg: linear-gradient(195deg, #0b1120 0%, #0d1526 40%, #0a1018 100%);
    --sidebar-item-active-bg: rgba(99, 102, 241, 0.15);
    --sidebar-item-hover-bg: rgba(255, 255, 255, 0.04);
    --sidebar-indicator: #6366f1;
    --sidebar-width-desktop: 220px;
    --sidebar-width-tablet: 200px;
    
    /* Navbar */
    --navbar-bg: rgba(8, 12, 24, 0.82);
    --navbar-height: 56px;
    --navbar-border: rgba(255, 255, 255, 0.06);
}

/* =============================================================================
   MODERN NAVBAR - React-style floating nav
   ============================================================================= */
.app-navbar,
.navbar {
    background: var(--navbar-bg) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border-bottom: 1px solid var(--navbar-border) !important;
    height: var(--navbar-height) !important;
    padding: 0 1rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 40px rgba(99, 102, 241, 0.03) !important;
}

/* Navbar icon buttons - React-style hover */
.navbar-icon-btn {
    position: relative;
    border-radius: 6px !important;
    width: 30px;
    height: 30px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 0 !important;
}

.navbar-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    filter: brightness(1.15);
}

.navbar-icon-btn:active {
    filter: brightness(0.9);
}

/* Navbar title with subtle gradient */
.navbar-title {
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 50%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =============================================================================
   MODERN SIDEBAR - Minimal with animated active indicator
   ============================================================================= */
#desktop-sidebar,
.sidebar {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.04) !important;
    padding: 0.5rem 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Section labels */
#desktop-sidebar .text-muted,
.sidebar .text-muted {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    color: rgba(148, 163, 184, 0.6) !important;
    padding: 0.75rem 1.25rem 0.25rem !important;
    margin: 0 !important;
}

/* Sidebar nav items */
.list-group-item {
    background: transparent !important;
    border: none !important;
    color: rgba(203, 213, 225, 0.8) !important;
    padding: 0.55rem 1rem 0.55rem 1.25rem !important;
    margin: 1px 0.5rem !important;
    border-radius: 8px !important;
    font-weight: 500;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.list-group-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--sidebar-indicator);
    border-radius: 0 4px 4px 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-group-item:hover {
    background: var(--sidebar-item-hover-bg) !important;
    color: rgba(248, 250, 252, 0.95) !important;
    transform: translateX(2px);
}

.list-group-item:hover::before {
    transform: translateY(-50%) scaleY(0.5);
}

.list-group-item.active {
    background: var(--sidebar-item-active-bg) !important;
    color: #e0e7ff !important;
    font-weight: 600;
    border-left: none !important;
}

.list-group-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

.list-group-item i {
    width: 18px;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.list-group-item:hover i {
    opacity: 1;
    color: var(--accent-primary);
}

.list-group-item.active i {
    opacity: 1;
    color: #818cf8;
}

/* =============================================================================
   SUMMARY CARDS - React MUI-style stat cards with gradient icons
   ============================================================================= */

/* ---- Dashboard Tile Flip (data ↔ sparkline every 30s) ---- */
.dash-flip-card {
    perspective: 800px;
    height: 90px;          /* fixed tile height */
}

.dash-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.dash-flip-card.flipped .dash-flip-inner {
    transform: rotateX(180deg);
}

.dash-flip-front,
.dash-flip-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
}

.dash-flip-back {
    transform: rotateX(180deg);
    display: flex;
    flex-direction: column;
    padding: 0.15rem 0.4rem 0.1rem;
    background: var(--dash-surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.dash-flip-back .spark-label {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.85);
    margin-bottom: 0;
    line-height: 1;
    flex-shrink: 0;
}

.dash-flip-back .spark-value {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, monospace;
    line-height: 1.1;
    margin-bottom: 1px;
    flex-shrink: 0;
}

.dash-flip-back iframe {
    flex: 1;
    width: 100%;
    min-height: 28px;
    max-height: 42px;
}

.dash-flip-back svg {
    flex: 1;
    width: 100%;
    min-height: 0;
    max-height: 42px;
}

/* Light theme */
body.light-theme .dash-flip-back {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}

.summary-card {
    background: var(--dash-surface) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden;
    position: relative;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.summary-card:hover {
    border-color: rgba(99, 102, 241, 0.2) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(99, 102, 241, 0.08) !important;
}

.summary-card:hover::before {
    opacity: 1;
}

.summary-card-body {
    padding: 0.75rem 0.875rem !important;
}

.summary-card-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: rgba(148, 163, 184, 0.85);
    text-transform: uppercase;
}

.summary-card-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, monospace;
    letter-spacing: -0.01em;
}

.summary-card-change {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, monospace;
}

/* =============================================================================
   PORTFOLIO TABS - React-style segmented control
   ============================================================================= */
#home-portfolio-tabs {
    border: none !important;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    display: inline-flex;
    margin-bottom: 1rem;
}

#home-portfolio-tabs .nav-link {
    border: none !important;
    border-radius: 8px !important;
    color: rgba(148, 163, 184, 0.8) !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    padding: 0.5rem 1.25rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: transparent !important;
    position: relative;
}

#home-portfolio-tabs .nav-link:hover {
    color: rgba(224, 231, 255, 0.9) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

#home-portfolio-tabs .nav-link.active {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #e0e7ff !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

/* =============================================================================
   STOCK TILES - React card grid with hover animations
   ============================================================================= */
.stock-tile,
.portfolio-stock-tile {
    background: var(--dash-surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 10px !important;
    padding: 0.875rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stock-tile:hover,
.portfolio-stock-tile:hover {
    background: var(--dash-surface-hover) !important;
    border-color: rgba(99, 102, 241, 0.15) !important;
    transform: translateY(-3px) scale(1.01) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 15px rgba(99, 102, 241, 0.06) !important;
}

/* Profit/Loss tile accent */
.stock-tile-profit,
.portfolio-stock-tile.profit-tile {
    border-left: 3px solid #10b981 !important;
}

.stock-tile-loss,
.portfolio-stock-tile.loss-tile {
    border-left: 3px solid #ef4444 !important;
}

/* =============================================================================
   MODERN CARDS - Glass effect with React-style
   ============================================================================= */
.card {
    background: var(--dash-surface) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(-1px);
}

/* Prevent card hover transform on modal cards and inline cards */
.modal .card:hover,
.tab-content .card:hover,
.offcanvas .card:hover {
    transform: none;
}

.card-header {
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 0.875rem 1.125rem !important;
    font-weight: 600;
}

/* =============================================================================
   BUTTONS - React MUI-style with ripple effect
   ============================================================================= */
.btn {
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: var(--dash-gradient-primary) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: var(--dash-gradient-success) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: var(--dash-gradient-danger) !important;
    border: none !important;
    color: white !important;
}

.btn-info {
    background: var(--dash-gradient-info) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

/* =============================================================================
   FORM INPUTS - Modern floating label feel
   ============================================================================= */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    color: #f1f5f9 !important;
    padding: 0.625rem 0.875rem !important;
    font-size: 0.85rem !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
    outline: none !important;
}

/* =============================================================================
   MODALS - React dialog style
   ============================================================================= */
.modal-content {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.05) !important;
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 1.125rem 1.375rem !important;
}

.modal-body {
    padding: 1.25rem 1.375rem !important;
}

/* =============================================================================
   TABS - React-style underline
   ============================================================================= */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    gap: 0;
}

.nav-tabs .nav-link {
    border: none !important;
    color: rgba(148, 163, 184, 0.7) !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    padding: 0.625rem 1rem !important;
    position: relative;
    transition: all 0.2s ease !important;
    background: transparent !important;
}

.nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--sidebar-indicator);
    transform: scaleX(0);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tabs .nav-link:hover {
    color: rgba(224, 231, 255, 0.9) !important;
}

.nav-tabs .nav-link:hover::after {
    transform: scaleX(0.5);
}

.nav-tabs .nav-link.active {
    color: #e0e7ff !important;
    font-weight: 600 !important;
}

.nav-tabs .nav-link.active::after {
    transform: scaleX(1);
}

/* =============================================================================
   ALERTS - React toast-style
   ============================================================================= */
.alert {
    border-radius: 10px !important;
    border-left: 4px solid !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(8px);
    padding: 0.875rem 1rem !important;
}

.alert-success {
    border-left-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.08) !important;
}

.alert-danger {
    border-left-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

.alert-warning {
    border-left-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.08) !important;
}

.alert-info {
    border-left-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.08) !important;
}

/* =============================================================================
   BADGES - React chip style
   ============================================================================= */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* =============================================================================
   PAGE CONTENT CONTAINER - React-style spacing
   ============================================================================= */
#page-content {
    animation: pageFadeIn 0.35s ease-out;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   DASHBOARD HOME PAGE - Modern metrics layout
   ============================================================================= */
/* Portfolio container */
.portfolio-container {
    animation: pageFadeIn 0.4s ease-out;
}

/* Welcome section for new users */
#workflow-welcome-image {
    text-align: center;
    padding: 2rem 1rem !important;
}

#workflow-welcome-image img {
    border-radius: 16px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.06);
    max-width: 60% !important;
    transition: transform 0.3s ease;
}

#workflow-welcome-image img:hover {
    transform: scale(1.02);
}

/* =============================================================================
   SEARCH PAGE - React-style search bar
   ============================================================================= */
.search-card,
.stock-search-card {
    background: var(--dash-surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease;
}

.search-card:focus-within,
.stock-search-card:focus-within {
    border-color: rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 20px rgba(99, 102, 241, 0.08) !important;
}

/* =============================================================================
   TABLES - Modern data grid style
   ============================================================================= */
.table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table thead th {
    background: rgba(15, 23, 42, 0.5) !important;
    color: rgba(148, 163, 184, 0.85) !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody td {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
    font-size: 0.82rem;
    color: rgba(226, 232, 240, 0.9) !important;
}

.table tbody tr {
    transition: background 0.15s ease !important;
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04) !important;
}

/* =============================================================================
   SCROLLBAR - Thin modern scrollbar
   ============================================================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.35);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

/* =============================================================================
   OFFCANVAS MOBILE MENU - Modern slide-in
   ============================================================================= */
.offcanvas {
    background: linear-gradient(195deg, #0b1120 0%, #0d1526 100%) !important;
    border: none !important;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5) !important;
}

.offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 1rem 1.25rem !important;
}

/* =============================================================================
   LOGIN MODAL - Modern glass effect
   ============================================================================= */
#login-modal .modal-content {
    background: rgba(10, 15, 30, 0.95) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.08) !important;
}

#login-modal .modal-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05)) !important;
}

/* =============================================================================
   LOADING SPINNERS - Modern pulsing
   ============================================================================= */
#pinned-spinner,
#add-stock-pinned-spinner,
#dashboard-pinned-spinner {
    background: rgba(10, 15, 30, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
}

/* =============================================================================
   PROGRESS BAR - Modern gradient
   ============================================================================= */
.progress {
    background: rgba(30, 41, 59, 0.5) !important;
    border-radius: 100px !important;
    height: 6px !important;
    overflow: hidden;
}

.progress-bar {
    background: var(--dash-gradient-primary) !important;
    border-radius: 100px !important;
}

/* =============================================================================
   INVESTMENT PAGE - React-style controls
   ============================================================================= */
.invest-page-container {
    animation: pageFadeIn 0.35s ease-out;
}

.risk-toggle-group .btn {
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

/* =============================================================================
   RESPONSIVE OVERRIDES
   ============================================================================= */
@media (max-width: 575.98px) {
    .summary-card-body {
        padding: 0.625rem 0.75rem !important;
    }
    
    .summary-card-value {
        font-size: 0.9rem;
    }
    
    .summary-card-label {
        font-size: 0.65rem;
    }
    
    .stock-tile,
    .portfolio-stock-tile {
        padding: 0.75rem !important;
    }
    
    .btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.875rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .summary-card-value {
        font-size: 0.95rem;
    }
}

/* =============================================================================
   MICRO-INTERACTIONS
   ============================================================================= */
/* Ripple effect on click */
@keyframes ripple {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.5;
    }
    to {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* Subtle glow on card focus */
.card:focus-within {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.1) !important;
}

/* Smooth page transitions */
.tab-content > .tab-pane {
    animation: pageFadeIn 0.25s ease-out;
}

/* Tooltip modernization */
.tooltip-inner {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
    font-size: 0.78rem !important;
    padding: 0.4rem 0.75rem !important;
}

/* =============================================================================
   FOOTER - Clean minimal
   ============================================================================= */
footer {
    border-top: 1px solid rgba(255, 255, 255, 0.04) !important;
    padding: 0.75rem 0 !important;
}

footer hr {
    border-color: rgba(255, 255, 255, 0.04) !important;
}

footer .text-muted {
    font-size: 0.72rem !important;
    color: rgba(100, 116, 139, 0.6) !important;
}

/* =============================================================================
   CHART MODALS - Modern overlay
   ============================================================================= */
.chart-modal .modal-content {
    background: rgba(10, 15, 30, 0.97) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.chart-modal-header {
    background: rgba(255, 255, 255, 0.02) !important;
}

.chart-modal-icon {
    color: #818cf8;
}

/* =============================================================================
   NOTIFICATION PANEL
   ============================================================================= */
#notifications-offcanvas {
    background: linear-gradient(195deg, #0b1120, #0d1526) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* =============================================================================
   KITE API SETTINGS PAGE
   ============================================================================= */
.kite-tab-content .card {
    transition: all 0.25s ease;
}

.kite-tab-content .card:hover {
    transform: none;
}

/* =============================================================================
   SIDEBAR HELPER CLASSES - Used by Python layout
   ============================================================================= */
.sidebar-container {
    padding: 0.5rem 0;
    height: 100%;
}

.sidebar-section-label {
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.5);
    padding: 0.875rem 1.25rem 0.375rem;
    margin: 0;
    user-select: none;
}

.sidebar-nav-group {
    margin-bottom: 0.25rem;
    padding: 0 0.375rem;
}

.sidebar-nav-item {
    background: transparent !important;
    border: none !important;
    color: rgba(203, 213, 225, 0.75) !important;
    padding: 0.5rem 0.875rem !important;
    margin: 1px 0 !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 0.8rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.625rem !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: hidden !important;
}

.sidebar-nav-item i {
    width: 18px !important;
    font-size: 0.82rem !important;
    opacity: 0.85;
    transition: all 0.2s ease !important;
    flex-shrink: 0;
    text-align: center;
}

/* ── Per-icon vibrant colors (dark theme) ── */
.sidebar-nav-item i.fa-th-large       { color: #60a5fa !important; } /* Dashboard - Blue */
.sidebar-nav-item i.fa-search          { color: #38bdf8 !important; } /* Stock Analysis - Sky */
.sidebar-nav-item i.fa-bolt            { color: #fbbf24 !important; } /* AI Top Picks - Amber */
.sidebar-nav-item i.fa-industry        { color: #a78bfa !important; } /* Sector Research - Violet */
.sidebar-nav-item i.fa-chart-line      { color: #34d399 !important; } /* Stock P&L - Emerald */
.sidebar-nav-item i.fa-chart-area      { color: #22d3ee !important; } /* Stock Trend - Cyan */
.sidebar-nav-item i.fa-tachometer-alt  { color: #f97316 !important; } /* Performance - Orange */
.sidebar-nav-item i.fa-chart-pie       { color: #fb7185 !important; } /* Invest Trend - Rose */
.sidebar-nav-item i.fa-shield-alt      { color: #a78bfa !important; } /* Risk - Violet */
.sidebar-nav-item i.fa-plus-circle     { color: #2dd4bf !important; } /* Add Stock - Teal */
.sidebar-nav-item i.fa-exchange-alt    { color: #94a3b8 !important; } /* Kite - Slate */
.sidebar-nav-item i.fa-coins           { color: #f472b6 !important; } /* Token Usage - Pink */
.sidebar-nav-item i.fa-book-open       { color: #818cf8 !important; } /* Documentation - Indigo */
.sidebar-nav-item i.fa-user-shield     { color: #94a3b8 !important; } /* Admin - Slate */

.sidebar-nav-item::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) scaleY(0) !important;
    width: 3px !important;
    height: 55% !important;
    background: var(--sidebar-indicator) !important;
    border-radius: 0 4px 4px 0 !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: rgba(248, 250, 252, 0.95) !important;
    transform: translateX(2px);
}

.sidebar-nav-item:hover i {
    opacity: 1 !important;
    filter: brightness(1.25);
}

.sidebar-nav-item:hover::before {
    transform: translateY(-50%) scaleY(0.5) !important;
}

.sidebar-nav-item.active {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #e0e7ff !important;
    font-weight: 600 !important;
}

.sidebar-nav-item.active i {
    opacity: 1 !important;
    filter: brightness(1.2) saturate(1.3);
}

.sidebar-nav-item.active::before {
    transform: translateY(-50%) scaleY(1) !important;
}
