/* assets/css/portfolio.css */

/* =========================================
   STATS GRID & DASHBOARD
   ========================================= */
.container { 
    max-width: 1300px; /* Portfolio is slightly tighter than Home */
    gap: 0; /* Remove global gap, use explicit margin-bottom on elements instead */
}
.card {
    border: 2px solid var(--border-color)
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Automatically fits 4 or 5 cards */
    gap: 20px;
    margin-bottom: 25px;
}
.stat-card { 
    background: var(--bg-card); 
    padding: 15px; 
    border-radius: 12px; 
    border: 2px solid var(--border-color); 
    text-align: center; 
}
.stat-label { 
    color: var(--text-muted); 
    font-size: 12px; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 5px; 
}

.stat-value { font-size: 20px; font-weight: bold; }

/* =========================================
   TABLES & CONTROLS
   ========================================= */
.table-controls { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
    gap: 15px; 
}
.search-input-wrapper { position: relative; flex: 1; max-width: 300px; }
.search-input-wrapper input { 
    width: 100%; 
    border-radius: 8px; 
    background: var(--bg-body); 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
    padding: 8px 8px 8px 35px; 
    outline: none; 
}
.search-icon { 
    position: absolute; left: 12px; top: 50%; 
    transform: translateY(-50%); color: var(--text-muted); font-size: 14px; 
}

table { width: 100%; border-collapse: collapse; }
th { 
    color: var(--text-muted); font-size: 11px; text-transform: uppercase; 
    padding: 15px; text-align: left; border-bottom: 1px solid var(--border-color); 
    cursor: pointer; white-space: nowrap; user-select: none; 
}
th:hover { color: var(--primary-color); }
td { padding: 15px; border-bottom: 1px solid var(--border-color); font-size: 14px; }

.group-row { cursor: pointer; transition: 0.2s; position: relative; isolation: isolate; }
.group-row:hover { background: var(--hover-bg); }

/* Weight Bar */
.weight-bar-container { 
    width: 100%; background: rgba(255,255,255,0.05); 
    height: 4px; border-radius: 2px; margin-top: 5px; overflow: hidden; 
}
.weight-bar-fill { 
    background: var(--primary-color); height: 100%; 
    border-radius: 2px; transition: width 0.6s ease; 
}

/* =========================================
   DETAIL HEADERS
   ========================================= */
.detail-header { 
    display: flex; justify-content: space-between; 
    align-items: flex-start; margin-bottom: 30px; 
}
.detail-header-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    margin-top: 0;
    flex-wrap: wrap;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 250px;
}
.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.header-title-group h2 {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-main);
}
.header-title-group p {
    font-size: 13px;
    color: var(--text-muted);
}
.header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .detail-header-new {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .header-left {
        width: 100%;
    }
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}
.close-btn { 
    background: none; border: 1px solid var(--border-color); 
    color: var(--text-main); font-size: 14px; cursor: pointer; 
    border-radius: 8px; padding: 8px 15px; font-weight: bold; 
}

/* =========================================
   CHARTS & VISUALS
   ========================================= */
.charts-grid { 
    display: grid; grid-template-columns: 1fr 1fr; 
    gap: 20px; margin-bottom: 25px; 
}
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-controls select { 
    background: var(--bg-body); color: var(--text-main); 
    border: 1px solid var(--border-color); padding: 5px 10px; 
    border-radius: 6px; font-size: 12px; cursor: pointer; width: auto; margin: 0; 
}
.chart-overlay-msg { 
    position: absolute; top: 50%; left: 50%; 
    transform: translate(-50%, -50%); color: var(--text-muted); 
    font-size: 14px; text-align: center; pointer-events: none; width: 80%; 
}
.chart-error { 
    color: #ff5252; background: rgba(255, 82, 82, 0.1); 
    padding: 10px; border-radius: 8px; border: 1px solid #ff5252; pointer-events: auto; 
}

/* =========================================
   MODALS & FORMS
   ========================================= */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); display: flex; 
    justify-content: center; align-items: center; 
    z-index: 3000; backdrop-filter: blur(4px); 
    overflow-y: auto;
    padding: 20px 0;
}
.modal { 
    background: var(--bg-card); padding: 35px; 
    border-radius: 16px; width: 450px; 
    border: 1px solid var(--border-color); position: relative; 
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    margin: auto;
}

input, select { 
    background: var(--bg-body); border: 1px solid var(--border-color); 
    color: var(--text-main); padding: 12px; border-radius: 8px; 
    width: 100%; margin-bottom: 12px; box-sizing: border-box; outline: none; 
}

.eye-icon { position: absolute; right: 12px; top: 12px; cursor: pointer; color: var(--text-muted); }

/* CGT Toggle */
.cgt-toggle { 
    display: inline-flex; 
    background: var(--bg-card); 
    border: 1px solid var(--border-color);
    border-radius: 8px; padding: 4px; gap: 4px; 
}
.cgt-toggle button { 
    border: none; background: none; 
    color: var(--text-muted); 
    padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; 
}
.cgt-toggle button.active { background: var(--primary-color); color: white; }

/* Chart Range Buttons */
.chart-range-btns {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    gap: 2px;
}
.chart-range-btns button {
    border: none;
    background: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.chart-range-btns button:hover {
    color: var(--text-main);
    background: var(--hover-bg);
}
.chart-range-btns button.active {
    background: var(--primary-color);
    color: white;
}

/* Chart Checkboxes Container */
.chart-checkboxes-container {
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.chart-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .chart-checkboxes-container {
        gap: 12px;
        padding: 10px;
    }
    
    .chart-checkbox-label {
        font-size: 13px;
    }
    
    .chart-checkbox-label span {
        white-space: normal;
        line-height: 1.2;
    }
}

/* View Toggle Button */
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn svg {
    flex-shrink: 0;
}

/* Portfolio Folder Row */
.portfolio-folder-row {
    cursor: pointer;
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--bg-body) !important;
    transition: background-color 0.2s ease;
    border-left: 5px solid transparent;
}
.portfolio-folder-row:hover {
    background-color: var(--hover-bg);
}
.portfolio-folder-row td {
    padding: 15px 12px;
    font-size: 14px;
    vertical-align: middle;
}

/* =========================================
   PORTFOLIO LIST VIEW (DOUBLE-HEIGHT ROWS)
   ========================================= */

.portfolio-list-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(41, 98, 255, 0.6) 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.portfolio-list-header th {
    color: white;
    padding: 18px 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.portfolio-folder-row {
    cursor: pointer;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color) !important;
    transition: all 0.3s ease;
    border-left: 5px solid var(--primary-color);
    height: 100px; /* Double the height of stock rows (standard ~50px) */
}

.portfolio-folder-row:nth-child(even) {
    background-color: rgba(41, 98, 255, 0.03);
}

.portfolio-folder-row:hover {
    background-color: var(--hover-bg);
    transform: translateX(5px);
    border-left-color: #FF6D00;
    box-shadow: inset -2px 0 10px rgba(41, 98, 255, 0.1);
}

.portfolio-folder-row td {
    padding: 20px 15px;
    font-size: 14px;
    vertical-align: middle;
    height: 100px;
    display: table-cell;
}

.portfolio-folder-row td:first-child {
    padding-left: 20px;
    border-left: 3px solid var(--primary-color);
}

/* Portfolio Total Row */
.portfolio-total-row {
    background-color: rgba(41, 98, 255, 0.08) !important;
    border-top: 2px solid var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color) !important;
    font-weight: 600;
    height: 60px;
}

.portfolio-total-row:hover {
    background-color: rgba(41, 98, 255, 0.08) !important;
    transform: none !important;
    cursor: default !important;
}

.portfolio-total-row td {
    padding: 15px;
    font-size: 15px;
    vertical-align: middle;
    height: 60px;
    display: table-cell;
}

/* Text color classes for P/L */
.positive {
    color: #4CAF50;
    font-weight: 600;
}

.negative {
    color: #f44336;
    font-weight: 600;
}

/* =========================================
   BUTTON STANDARDIZATION
   ========================================= */

.btn-primary.same-size,
.btn-secondary.same-size,
.btn-danger.same-size {
    padding: 10px 12px;
    width: 130px;
    text-align: center;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary.same-size {
    background: #4CAF50;
    color: white;
}

.btn-primary.same-size:hover {
    background: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary.same-size {
    background: #f44336;
    color: white;
}

.btn-secondary.same-size:hover {
    background: #d32f2f;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.btn-danger {
    background: #f44336;
    border: 1px solid #f44336;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-danger:hover {
    background: #da190b;
    opacity: 0.9;
}

.btn-danger.same-size {
    background: #f44336;
    color: white;
    padding: 10px 12px;
}

.btn-danger.same-size:hover {
    background: #da190b;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* =========================================
   INLINE STYLES FROM PORTFOLIO.HTML
   (Extracted for better organization)
   ========================================= */

/* 1. VUE UTILITY */
[v-cloak] { display: none !important; }
[v-cloak] * { display: none !important; }
.modal-backdrop[v-cloak] { display: none !important; }

/* 2. AUTH CARD (Override) */
.auth-card {
    max-width: 500px !important; 
    width: 95%;
    margin: 60px auto;
    padding: 40px;
    text-align: center;
}

/* 3. CONTAINER PADDING (Override for navbar) */
.container { max-width: 1300px; }
/* 4. APP LAYOUT */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.content-wrapper { flex: 1; padding-top: 20px; padding-bottom: 50px; padding-left: 20px; padding-right: 20px; }

/* Reduce padding on mobile for more content space */
@media (max-width: 768px) {
    .content-wrapper {
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* Button icons for import/export actions */
.table-header .btn-success::before { content: "📊 "; }
.table-header .btn-warning::before { content: "📄 "; }
.btn-primary[onclick*="exportSummary"]::before,
.btn-primary[onclick*="exportDetailed"]::before { content: "📥 "; }

/* Consistent top spacing for all portfolio views */
.portfolio-page-header {
    margin-top: 20px;
}
/* 5. TOAST & ANIMATIONS */
.toast-container { 
    position: fixed; bottom: 30px; left: 50%; 
    transform: translateX(-50%); z-index: 9999; pointer-events: none; 
}
.toast { 
    background: #2e7d32; color: white; padding: 12px 24px; 
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); 
    font-weight: 500; display: flex; align-items: center; gap: 10px; 
    animation: slideUp 0.3s ease-out; 
}
@keyframes slideUp { 
    from { transform: translateY(100%); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

/* 6. AUTOCOMPLETE DROPDOWN */
.search-container { position: relative; width: 100%; }
.autocomplete-dropdown { 
    position: absolute; top: 100%; left: 0; right: 0; 
    background: var(--bg-card); border: 1px solid var(--border-color); 
    border-radius: 8px; max-height: 200px; overflow-y: auto; 
    z-index: 9999; box-shadow: 0 10px 25px rgba(0,0,0,0.5); 
}
.dropdown-item { 
    padding: 12px 15px; cursor: pointer; 
    border-bottom: 1px solid var(--border-color); 
    display: flex; justify-content: space-between; transition: background 0.2s; 
}
.dropdown-item:hover { background: rgba(41, 98, 255, 0.1); }
.dropdown-symbol { font-weight: bold; color: var(--primary-color); }
.dropdown-name { font-size: 11px; color: var(--text-muted); }

/* 7. SELECTED BADGE */
.selected-badge { 
    background: rgba(41, 98, 255, 0.05); border: 1px solid var(--primary-color); 
    padding: 10px; border-radius: 8px; margin: 10px 0; font-size: 13px; 
}

/* 8. VIEW TABS */
.view-tabs { 
    display: flex; gap: 5px; background: var(--bg-card); padding: 5px; 
    border-radius: 10px; border: 1px solid var(--border-color); 
    margin-bottom: 20px; width: fit-content; 
}
.view-tab { 
    padding: 8px 20px; border-radius: 8px; cursor: pointer; 
    font-size: 13px; font-weight: bold; color: var(--text-muted); transition: 0.2s; 
}
.view-tab.active { background: var(--primary-color); color: white; }

/* 9. TRANSACTION TAGS */
.trx-tag { 
    font-size: 10px; padding: 2px 6px; border-radius: 4px; 
    text-transform: uppercase; font-weight: bold; 
}
.trx-buy { background: rgba(76, 175, 80, 0.15); color: #4CAF50; }
.trx-sell { background: rgba(244, 67, 54, 0.15); color: #f44336; }

/* 10. SIDE TOGGLE (BUY/SELL) */
.side-toggle { 
    display: flex; border: 1px solid var(--border-color); 
    border-radius: 6px; overflow: hidden; margin-bottom: 15px; 
}
.side-toggle button { 
    flex: 1; padding: 10px; border: none; background: var(--bg-body); 
    color: var(--text-muted); cursor: pointer; font-weight: bold; 
}
.side-toggle button.active-buy { background: #2e7d32; color: white; }
.side-toggle button.active-sell { background: #d32f2f; color: white; }

/* 11. TABLE HEADER (Override) */
.table-header {
    background: var(--bg-body);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    min-height: 50px;
    flex-wrap: wrap;
}

.table-header .flex-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-header .flex-row.flex-grow {
    flex: 1;
    min-width: 300px;
}

.table-header .flex-row.flex-shrink {
    flex-shrink: 0;
}

/* 12. PORTFOLIO SELECTOR */
.portfolio-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
}

.portfolio-selector select {
    max-width: 180px;
    min-width: 150px;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
}

/* Search input wrapper */
.search-input-wrapper {
    position: relative;
    min-width: 200px;
    max-width: 300px;
}

.search-input-wrapper input {
    padding-left: 32px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* =========================================
   CARD VIEW LAYOUT
   ========================================= */
.card-view-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px;
}

.stock-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stock-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.stock-card.card-positive {
    border: 2px solid #4caf50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.stock-card.card-negative {
    border: 2px solid #f44336;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.15);
}

.stock-card-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stock-card-title {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.portfolio-qty-badge {
    background: rgba(41, 98, 255, 0.1);
    border: 1px solid rgba(41, 98, 255, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.stock-card-checkbox {
    padding-top: 2px;
}

.stock-card-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.stock-symbol-large {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.stock-card-sector {
    background: var(--bg-body);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.stock-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stock-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.3);
}

.stock-card-row:last-child {
    border-bottom: none;
}

.card-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.card-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

.card-value-bold {
    font-weight: 700;
    font-size: 15px;
}

.stock-card-footer {
    padding: 12px 15px;
    background: var(--bg-body);
}

/* Transaction card styles */
.transactions-card-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 5px;
}

.transaction-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.transaction-total-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    border: 2px solid var(--primary-color);
}

.transaction-card .stock-card-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.empty-state-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Portfolio folder card styling */
.portfolio-folder-card {
    cursor: pointer;
}

.portfolio-folder-card .folder-icon {
    font-size: 28px;
    margin-right: 8px;
}

.portfolio-total-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    border: 2px solid var(--primary-color);
    cursor: default;
}

.portfolio-total-card:hover {
    transform: none;
    border-color: var(--primary-color);
}

/* =========================================
   STICKY TABLE HEADERS
   ========================================= */
.portfolio-table {
    position: relative;
}

.portfolio-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
}

.portfolio-table thead th {
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile adjustments for card view */
@media (max-width: 768px) {
    .card-view-container {
        grid-template-columns: 1fr;
        padding: 5px;
        gap: 12px;
    }
    
    .stock-card-body {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stock-card-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px;
        gap: 3px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 6px;
        border-bottom: none;
    }
    
    .stock-card-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .stock-card-sector {
        align-self: flex-start;
    }
}

/* =========================================
   UTILITY CLASSES (Replacing Inline Styles)
   ========================================= */

/* Logo SVG */
.logo svg {
    color: var(--primary-color);
}

/* Button Utilities */
.btn-auto {
    width: auto;
}

.btn-secondary {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-success {
    background: #4CAF50;
}

.btn-warning {
    background: #FF9800;
}

.btn-info {
    background: #2196F3;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}

.btn-logout {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-theme {
    border: none;
    width: 36px;
    height: 36px;
    font-size: 18px;
}

.btn-back {
    padding: 8px 12px;
}

/* Text Utilities */
.text-danger {
    color: var(--danger-color);
}

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

.text-muted-sm {
    color: var(--text-muted);
}

.text-xs {
    font-size: 12px;
}

.text-sm {
    font-size: 14px;
}

.text-bold {
    font-weight: bold;
}

.text-semibold {
    font-weight: 600;
}

/* Spacing Utilities */
.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-25 {
    margin-bottom: 25px;
}

.mt-25 {
    margin-top: 25px;
}

.mb-30 {
    margin-bottom: 30px;
}

.m-0 {
    margin: 0;
}

.mt-5 {
    margin-top: 5px;
}

.mt-0 {
    margin-top: 0;
}

/* Layout Utilities */
.flex-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-col-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.flex-gap-10 {
    display: flex;
    gap: 10px;
}

.flex-gap-15 {
    display: flex;
    gap: 15px;
    flex-grow: 1;
    align-items: center;
}

.flex-wrap {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.flex-shrink {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.flex-grow {
    flex-grow: 1;
}

/* Table Utilities */
.td-icon {
    font-size: 20px;
    text-align: center;
}

.td-center {
    text-align: center;
}

.th-sm {
    width: 40px;
}

.th-md {
    width: 100px;
}

.td-sector {
    font-size: 12px;
}

.th-actions {
    width: 100px;
}

/* Auth Card */
.auth-container {
    text-align: center;
    padding: 50px;
}

.auth-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.6;
}

#google-btn {
    min-height: 44px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.empty-state-content {
    max-width: 500px;
    margin: 0 auto;
}

.empty-folder {
    text-align: center;
    padding: 50px;
}

/* Stats Details */
.stat-detail {
    font-size: 12px;
    font-weight: normal;
}

.stat-pct {
    font-size: inherit;
    font-weight: normal;
}

.stat-value-lg {
    font-size: 1.1em;
}

/* Chart Containers */
.chart-section {
    margin-bottom: 25px;
}

/* Chart Extremes Line (High/Low) - Single horizontal line */
.chart-extremes-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    margin-bottom: 20px;
}

.chart-extremes-line .extreme-high,
.chart-extremes-line .extreme-low {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-extremes-line .extreme-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.chart-extremes-line .extreme-value {
    font-size: 16px;
    font-weight: 700;
}

.chart-extremes-line .extreme-high .extreme-label {
    color: #4CAF50;
}

.chart-extremes-line .extreme-high .extreme-value {
    color: #4CAF50;
}

.chart-extremes-line .extreme-low .extreme-label {
    color: #ff6b6b;
}

.chart-extremes-line .extreme-low .extreme-value {
    color: #ff6b6b;
}

@media (max-width: 768px) {
    .chart-extremes-line {
        flex-direction: column;
        gap: 8px;
        padding: 10px 15px;
        align-items: center;
    }
    
    .chart-extremes-line .extreme-label {
        font-size: 11px;
    }
    
    .chart-extremes-line .extreme-value {
        font-size: 14px;
    }
}

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

.chart-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-color);
}

.chart-sync-time {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 10px;
}

.chart-container-lg {
    height: 350px;
    position: relative;
    width: 100%;
}

/* Chart Legend/Tooltip */
.chart-legend { 
    position: absolute; 
    left: 12px; 
    top: 12px; 
    z-index: 10; 
    background: rgba(30, 30, 30, 0.95); 
    color: #fff; 
    border: 1px solid #444; 
    padding: 12px; 
    border-radius: 6px; 
    font-size: 14px; 
    pointer-events: none; 
    display: none; 
    min-width: 200px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    line-height: 1.6;
}

[data-theme="light"] .chart-legend { 
    background: rgba(255, 255, 255, 0.95); 
    color: #000; 
    border-color: #ddd; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
}

.chart-container-md {
    height: 250px;
}

.chart-container-sm {
    height: 150px;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

.chart-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    width: 100%;
}

.chart-subtitle {
    font-size: 11px;
    margin-bottom: 5px;
}

/* Stock Extremes Grid */
.extremes-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 20px;
}

/* Special Labels */
.label-high {
    color: var(--primary-color);
}

.label-low {
    color: var(--hm-down-bg);
}

/* Card Variations */
.card-no-padding {
    padding: 0;
    overflow: hidden;
}

/* White Space */
.ws-nowrap {
    white-space: nowrap;
}

/* Additional Flex Utilities */
.flex-gap-5 {
    display: flex;
    gap: 5px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    justify-content: center;
}

/* Width Utilities */
.w-full {
    width: 100%;
}

.input-md {
    width: 120px;
}

.input-full {
    width: 100%;
    margin-bottom: 15px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px;
    border-radius: 4px;
}

/* Grid Utilities */
.stats-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Text Utilities */
.text-left {
    text-align: left;
}

.text-tertiary {
    color: var(--tertiary-color);
}

.text-medium {
    font-weight: 500;
}

.stat-value-lg {
    font-size: 1.1em;
}

/* Margin Utilities */
.mx-auto {
    max-width: 500px;
    margin: 0 auto;
}

.mt-5 {
    margin-top: 5px;
}

.mt-20 {
    margin-top: 20px;
}

/* Table Utilities */
.td-right {
    text-align: right;
}

/* Button Utilities */
.btn-edit {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    margin-right: 10px;
}

.btn-edit:hover {
    text-decoration: underline;
}

.btn-delete {
    background: none;
    border: none;
    color: var(--hm-down-bg);
    font-size: 18px;
    cursor: pointer;
}

.btn-delete:hover {
    opacity: 0.8;
}

/* Transaction Row Backgrounds */
.trx-bg-sell {
    background-color: rgba(255, 0, 0, 0.25);
}

[data-theme="light"] .trx-bg-sell {
    background-color: rgba(255, 0, 0, 0.25);
}

.trx-bg-buy {
    background-color: rgba(0, 255, 0, 0.25);
}

[data-theme="light"] .trx-bg-buy {
    background-color: rgba(0, 255, 0, 0.25);
}

.aggregate-row {
    background-color: rgba(33, 150, 243, 0.15);
    border-top: 2px solid var(--primary-color);
    font-weight: bold;
}

.aggregate-row td {
    padding: 12px 8px !important;
}

/* Chart Utilities */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    width: 100%;
}

/* Ledger Section - Separate from Transactions Table */
.ledger-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.08);
}

.ledger-section .card {
    margin-bottom: 30px;
}

.ledger-section .card:last-child {
    margin-bottom: 0;
}

/* Ledger Cards Container */
.ledger-cards-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 12px 0;
}

.ledger-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(30, 30, 35, 0.8);
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ledger-card:hover {
    background: rgba(40, 40, 45, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ledger-card-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.ledger-card-value {
    font-size: 15px;
    color: #fff;
    font-weight: 600;
}

.ledger-card-total {
    background: linear-gradient(135deg, rgba(78, 115, 223, 0.25), rgba(78, 115, 223, 0.1));
    border: 2px solid rgba(78, 115, 223, 0.5);
    margin-top: 8px;
    padding: 18px 20px;
    box-shadow: 0 3px 12px rgba(78, 115, 223, 0.2);
}

.ledger-card-total .ledger-card-label,
.ledger-card-total .ledger-card-value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

/* Legacy Ledger Utilities (for Sell Ledger backward compatibility) */
.ledger-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ledger-row.flex-center {
    align-items: center;
}

.ledger-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #444;
}

.divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

/* Modal Utilities */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 90vw;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
}

.modal-body {
    padding: 0 35px 20px 35px;
}

.modal-footer {
    padding: 20px 35px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-sm {
    width: 500px;
}

/* Export Modal */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.export-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-body);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.export-option-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-card);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.export-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.export-details {
    flex: 1;
}

.export-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--text-main);
}

.export-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Import Box */
.import-box {
    background: rgba(41, 98, 255, 0.05);
    border: 1px dashed var(--primary-color);
    padding: 15px;
    border-radius: 12px;
}

.import-box.text-center {
    text-align: center;
}

/* Help Toggle Button */
.help-toggle-container {
    text-align: center;
}

.btn-help {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-help:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(41, 98, 255, 0.3);
}

/* Help Section */
.help-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    animation: slideDown 0.3s ease;
}

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

.help-step {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.help-step:last-of-type {
    border-bottom: none;
    margin-bottom: 10px;
}

.help-step strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.help-step p {
    margin: 5px 0;
    color: var(--text-color);
    font-size: 13px;
    line-height: 1.5;
}

.help-step ul {
    margin: 8px 0;
    padding-left: 20px;
    color: var(--text-color);
    font-size: 13px;
}

.help-step li {
    margin-bottom: 5px;
    line-height: 1.5;
}

.help-step a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.help-step a:hover {
    text-decoration: underline;
}

.help-note {
    background: rgba(41, 98, 255, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    margin-top: 10px;
}

.help-note strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

/* Label Hints */
.label-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
}

.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: -10px 0 0 0;
    font-style: italic;
}

/* Label Utilities */
.label-left {
    display: block;
    margin-bottom: 5px;
    text-align: left;
}

.label-block {
    display: block;
    margin-bottom: 5px;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 300px;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    background: var(--bg-body);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading-percent {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* Overflow */
.overflow-auto {
    overflow-x: auto;
}

/* Positioning */
.cursor-pointer {
    cursor: pointer;
}

/* Portfolio Folder Row Styling */
.folder-icon {
    font-size: 20px;
    text-align: center;
}

.folder-name {
    font-weight: bold;
    color: var(--primary-color);
}

.folder-subtitle {
    font-size: 10px;
    color: var(--text-muted);
}

/* Stock Row Styling */
.stock-symbol {
    font-weight: bold;
    color: var(--primary-color);
}

.stock-company {
    font-size: 10px;
    color: var(--text-muted);
}

.stock-value {
    font-weight: bold;
}

/* Detail View Header */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.detail-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.detail-title {
    margin: 0;
}

.detail-subtitle {
    color: var(--text-muted);
    margin: 5px 0 0 0;
    font-size: 14px;
}

/* Transaction Row Backgrounds - defined above, removed duplicates */

/* Error State */
.error-hint {
    font-size: 12px;
    opacity: 0.7;
}

/* Portfolio Selector Label */
.portfolio-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Table Info Text */
.table-info {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* =========================================
   PUBLIC PROFILE SECTION
   ========================================= */
.public-profile-section {
    width: 100%;
}

.public-profile-header {
    text-align: center;
    padding: 20px 0;
}

.public-profile-header h1 {
    font-size: 32px;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.public-profile-header .text-muted {
    font-size: 16px;
    opacity: 0.7;
}

.portfolio-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.portfolio-list-item {
    display: block;
    padding: 20px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.portfolio-list-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.portfolio-list-item h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.portfolio-list-item .text-muted {
    margin: 0;
}

.public-profile-section .card {
    margin-bottom: 20px;
}

/* Mobile responsiveness for public profiles */
@media (max-width: 768px) {
    .public-profile-header h1 {
        font-size: 24px;
    }
    
    .public-profile-header .text-muted {
        font-size: 14px;
    }
    
    /* Merge stat grid sections on mobile for compact layout without gaps */
    .stats-mobile-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 25px; /* Add spacing after stats before chart */
    }
    
    .stats-mobile-wrapper .stats-grid-3,
    .stats-mobile-wrapper .stats-grid-4 {
        display: contents; /* Remove the nested grid, make children participate in parent grid */
    }
    
    /* Make table header responsive on mobile */
    .table-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .table-header .flex-row {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .table-header .portfolio-selector {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .table-header .portfolio-selector select {
        width: 100%;
        max-width: 100%;
    }
    
    /* Make buttons smaller on mobile */
    .table-header button {
        font-size: 13px;
        padding: 8px 12px;
        white-space: nowrap;
    }
    
    /* Chart header and range buttons responsive */
    .chart-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start !important;
    }
    
    .chart-range-btns {
        width: 100%;
        justify-content: space-between;
    }
    
    .chart-range-btns button {
        padding: 6px 8px;
        font-size: 11px;
        flex: 1;
    }
    
    /* Make ledger/simulator grids show 1 column on mobile */
    .stats-grid-2,
    .stats-grid-3:not(.stats-mobile-wrapper .stats-grid-3) {
        grid-template-columns: 1fr;
    }
    
    /* Transaction card styles */
    .transaction-card .stock-card-footer {
        display: flex;
        gap: 10px;
        justify-content: center;
    }
}

/* Transaction views are controlled by Vue v-if directives */

/* =========================================
   LOADING SPINNER
   ========================================= */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* Tab Buttons Container */
.tab-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    flex-wrap: wrap;
    gap: 10px;
}

/* Tab Buttons Styling - Use view-tabs style */
.tab-buttons {
    display: flex;
    gap: 5px;
    background: var(--bg-card);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.tab-button {
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-muted);
    transition: 0.2s;
    border: none;
    background: transparent;
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--text-color);
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
}
/* =========================================
   REAL-TIME PRICE STATUS INDICATOR
   ========================================= */
.price-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.3s ease;
}

.price-status-indicator.market-open {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.price-status-indicator.market-closed {
    border-color: var(--text-muted);
    background: rgba(100, 100, 100, 0.1);
}

.price-status-indicator .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.market-open .status-dot {
    background: #10b981;
    animation: pulse-green 2s ease-in-out infinite;
}

.market-closed .status-dot {
    background: var(--text-muted);
}

@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.price-status-indicator .status-text {
    color: var(--text-main);
    font-weight: 600;
}

.price-status-indicator .status-time {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: normal;
}