/* shared.css */

:root {
    --bg-dark: #121212; --surface-dark: #1e1e1e; --primary-dark: #bb86fc; --text-dark: #e0e0e0; --border-dark: #333333;
    --bg-light: #f5f5f5; --surface-light: #ffffff; --primary-light: #6200ee; --text-light: #212121; --border-light: #e0e0e0;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; --sidebar-width-collapsed: 80px; --sidebar-width-expanded: 250px; --header-height: 70px; --transition-speed: 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Body */
body { font-family: var(--font-family); display: flex; transition: background-color var(--transition-speed), color var(--transition-speed); overflow-x: hidden; overflow-y: auto; }
body.dark-mode { background-color: var(--bg-dark); color: var(--text-dark); }
body.light-mode { background-color: var(--bg-light); color: var(--text-light); }

/* Scrollbars */
html { scrollbar-width: thin; scrollbar-color: #555 transparent; }
body.light-mode { scrollbar-color: #ccc transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--primary-dark) !important; }
body.light-mode ::-webkit-scrollbar-thumb { background-color: #ccc; }
body.light-mode ::-webkit-scrollbar-thumb:hover, body.light-mode ::-webkit-scrollbar-thumb:active { background-color: var(--primary-light) !important; }

/* Main Wrapper */
/* padding-top: 120px pushes content down below the Fixed Header (70px) + Fixed Price Bar (~40px) */
.main-wrapper { margin-left: var(--sidebar-width-collapsed); width: calc(100% - var(--sidebar-width-collapsed)); transition: margin-left var(--transition-speed), width var(--transition-speed); display: flex; flex-direction: column; height: auto; min-height: 100vh; padding: 30px; padding-top: 120px; }

/* Sidebar Styles */
.sidebar { width: var(--sidebar-width-collapsed); height: 100vh; position: fixed; top: 0; left: 0; z-index: 200; transition: width var(--transition-speed); display: flex; flex-direction: column; }
.dark-mode .sidebar { background-color: var(--surface-dark); border-right: 1px solid var(--border-dark); }
.light-mode .sidebar { background-color: var(--surface-light); border-right: 1px solid var(--border-light); }
.sidebar.expanded { width: var(--sidebar-width-expanded); }

.sidebar-top { display: flex; flex-direction: column; align-items: center; padding: 10px 0; }
.sidebar-header { display: flex; align-items: center; justify-content: flex-start; padding: 10px 20px; height: var(--header-height); width: 100%; }
.sidebar.collapsed .sidebar-header { justify-content: center; }

.sidebar .logo { width: 40px; height: 40px; flex-shrink: 0; transition: margin var(--transition-speed); }
.sidebar.expanded .logo { margin-right: 10px; }

/* Sidebar Title */
.sidebar .sidebar-title { opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; white-space: nowrap; font-weight: bold; font-size: 1.2rem; }
.sidebar.collapsed .sidebar-title { display: none; } 
.sidebar.expanded .sidebar-title { display: block; opacity: 1; visibility: visible; }

.sidebar .sidebar-title .fun-text { transition: color var(--transition-speed); }
.dark-mode .sidebar .sidebar-title .fun-text { color: var(--primary-dark); }
.light-mode .sidebar .sidebar-title .fun-text { color: var(--primary-light); }
.dark-mode .sidebar .sidebar-title { color: var(--text-dark); }
.light-mode .sidebar .sidebar-title { color: var(--text-light); }

.sidebar-toggle { background-color: transparent; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform var(--transition-speed), background-color var(--transition-speed); margin-top: 10px; }
.dark-mode .sidebar-toggle { color: #888; border: 1px solid #444; }
.light-mode .sidebar-toggle { color: #777; border: 1px solid #ccc; }
.sidebar-toggle:hover { background-color: rgba(255,255,255,0.1); }
.light-mode .sidebar-toggle:hover { background-color: rgba(0,0,0,0.05); }
.sidebar.expanded .sidebar-toggle { transform: rotate(180deg); }

.sidebar-menu { list-style: none; padding-top: 10px; }
.sidebar-menu a { display: flex; align-items: center; padding: 15px 28px; text-decoration: none; white-space: nowrap; transition: background-color var(--transition-speed); }
.dark-mode .sidebar-menu a { color: var(--text-dark); }
.light-mode .sidebar-menu a { color: var(--text-light); }
.sidebar-menu a:hover, .sidebar-menu a.active { background-color: rgba(187, 134, 252, 0.1); }
.light-mode .sidebar-menu a:hover, .light-mode .sidebar-menu a.active { background-color: rgba(98, 0, 238, 0.1); }
.sidebar-menu a i { font-size: 1.5rem; margin-right: 20px; width: 24px; text-align: center; }
.sidebar-menu a span { opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; }
.sidebar.expanded .sidebar-menu a span { opacity: 1; visibility: visible; }

/* --- HEADER STYLES --- */
/* FIXED POSITIONING RESTORED */
.header-bar { 
    position: fixed; /* Fixed relative to viewport */
    top: 0; 
    height: var(--header-height); 
    display: grid; 
    grid-template-columns: 1fr auto 1fr; 
    align-items: center; 
    padding: 0 30px; 
    z-index: 100; /* Higher than Price Bar (90) */
    flex-shrink: 0; 
    left: var(--sidebar-width-collapsed); 
    width: calc(100% - var(--sidebar-width-collapsed)); 
    transition: left var(--transition-speed), width var(--transition-speed); 
}
.dark-mode .header-bar { background-color: var(--surface-dark); border-bottom: 1px solid var(--border-dark); }
.light-mode .header-bar { background-color: var(--surface-light); border-bottom: 1px solid var(--border-light); }

.search-container { position: relative; width: 100%; max-width: 350px; justify-self: center; }
.search-container i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); opacity: 0.6; }
.search-container input { width: 100%; padding: 10px 15px 10px 40px; border-radius: 20px; border: 1px solid; outline: none; transition: border-color var(--transition-speed); }
.dark-mode .search-container input { background-color: var(--bg-dark); color: var(--text-dark); border-color: var(--border-dark); }
.light-mode .search-container input { background-color: var(--bg-light); color: var(--text-light); border-color: var(--border-light); }
.dark-mode .search-container input:focus { border-color: var(--primary-dark); }
.light-mode .search-container input:focus { border-color: var(--primary-light); }

.header-actions { display: flex; align-items: center; gap: 15px; justify-self: end; }
.btn { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; transition: transform 0.2s, opacity 0.2s; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-primary { background-color: var(--primary-dark); color: #000; }
.light-mode .btn-primary { background-color: var(--primary-light); color: #fff; }
.btn-secondary { background: none; border: 1px solid; }
.dark-mode .btn-secondary { border-color: var(--primary-dark); color: var(--primary-dark); }
.light-mode .btn-secondary { border-color: var(--primary-light); color: var(--primary-light); }

.theme-toggle-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.dark-mode .theme-toggle-btn { color: var(--text-dark); }
.light-mode .theme-toggle-btn { color: var(--text-light); }

.user-profile-container { position: relative; }
.user-profile { cursor: pointer; display: flex; align-items: center; gap: 10px; background-color: rgba(255,255,255,0.05); padding: 5px 10px; border-radius: 20px; }
.light-mode .user-profile { background-color: rgba(0,0,0,0.05); }
.user-profile img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; pointer-events: none; }
.user-profile span { font-weight: bold; font-size: 0.9em; pointer-events: none; }
.user-profile .fa-chevron-down { font-size: 0.8em; margin-left: 5px; transition: transform 0.2s; pointer-events: none; }
.user-profile-container.open .fa-chevron-down { transform: rotate(180deg); }

.dropdown-menu { display: none; position: absolute; top: 110%; right: 0; background-color: var(--surface-dark); border: 1px solid var(--border-dark); border-radius: 8px; min-width: 150px; box-shadow: 0 8px 16px rgba(0,0,0,0.3); z-index: 1001; }
.light-mode .dropdown-menu { background-color: var(--surface-light); border-color: var(--border-light); }
.dropdown-menu.show { display: block; }
.dropdown-menu button { width: 100%; background: none; border: none; color: var(--text-dark); padding: 12px 16px; text-align: left; font-size: 0.9em; cursor: pointer; display: flex; align-items: center; }
.light-mode .dropdown-menu button { color: var(--text-light); }
.dropdown-menu button:hover { background-color: rgba(255, 255, 255, 0.05); }
.light-mode .dropdown-menu button:hover { background-color: rgba(0, 0, 0, 0.05); }
.dropdown-menu button i { margin-right: 10px; opacity: 0.7; width: 16px; text-align: center; }

/* --- PRICE TICKER BAR --- */
#price-ticker-bar { 
    position: fixed; 
    left: var(--sidebar-width-collapsed); 
    width: calc(100% - var(--sidebar-width-collapsed)); 
    top: var(--header-height); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 10px 25px; 
    padding: 8px; 
    background-color: #0a0a0a; 
    border-bottom: 1px solid var(--border-dark); 
    font-size: 0.9rem; 
    z-index: 90; /* Lower than Header (100) */
    transition: left var(--transition-speed), width var(--transition-speed); 
}
#price-ticker-bar span { white-space: nowrap; }
#price-ticker-bar a { color: var(--primary-dark); text-decoration: none; font-weight: bold; }
#price-ticker-bar a:hover { text-decoration: underline; }
#price-ticker-bar val { font-weight: bold; }
.positive {color: var(--success-color, #4CAF50) !important; /* Green */}
.negative {color: var(--error-color, #F44336) !important; /* Red */}

/* --- MODAL STYLES --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity var(--transition-speed), visibility var(--transition-speed); }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal { padding: 30px; border-radius: 12px; width: 90%; max-width: 400px; transform: scale(0.9); transition: transform var(--transition-speed); }
.dark-mode .modal { background-color: var(--surface-dark); }
.light-mode .modal { background-color: var(--surface-light); }
.modal-overlay.show .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.close-modal-btn { background: none; border: none; font-size: 2rem; cursor: pointer; line-height: 1; color: inherit; }
.modal-body { display: flex; flex-direction: column; gap: 10px; }
.wallet-option { padding: 15px; border: 1px solid; border-radius: 8px; text-align: left; font-size: 1rem; cursor: pointer; display: flex; align-items: center; gap: 15px; }
.dark-mode .wallet-option { background-color: var(--bg-dark); border-color: var(--border-dark); color: var(--text-dark); }
.light-mode .wallet-option { background-color: var(--bg-light); border-color: var(--border-light); color: var(--text-light); }
.dark-mode .wallet-option:hover { border-color: var(--primary-dark); }
.light-mode .wallet-option:hover { border-color: var(--primary-light); }
.wallet-icon { width: 28px; height: 28px; object-fit: contain; }

/* --- GLOBAL STATE: Sidebar Expanded (Pushes Content) --- */
body.sidebar-is-expanded .header-bar { left: var(--sidebar-width-expanded); width: calc(100% - var(--sidebar-width-expanded)); }
body.sidebar-is-expanded #price-ticker-bar { left: var(--sidebar-width-expanded); width: calc(100% - var(--sidebar-width-expanded)); }
body.sidebar-is-expanded .main-wrapper { margin-left: var(--sidebar-width-expanded); width: calc(100% - var(--sidebar-width-expanded)); }