/* Nord Tema - Modernt, techigt, nördigt och skandinaviskt */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --nord0: #1e2227;  /* Ännu mörkare nattblå - huvudbakgrund */
    --nord1: #2E3440;  /* Header-bakgrund */
    --nord2: #3B4252;  /* Kort/inputs */
    --nord3: #4C566A;  /* Sekundär text, borders */
    --nord4: #ECEFF4;  /* Ljusare primär text för bättre kontrast */
    --nord8: #88C0D0;  /* Tech-accent (cyan) */
    --nord11: #BF616A; /* Negativ (röd) */
    --nord13: #EBCB8B; /* Neutral (gul) */
    --nord14: #A3BE8C; /* Positiv (grön) */
    --bg-primary: var(--nord0);
    --bg-secondary: var(--nord1);
    --bg-tertiary: var(--nord2);
    --text-primary: var(--nord4);
    --text-secondary: var(--nord3);
    --accent: var(--nord14);
    --accent-hover: #7cb518;
    --border: var(--nord3);
    --error: var(--nord11);
    --warning: var(--nord13);
    --radius: 4px;
    --spacing: 0.75rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    font-size: 12px;
    font-weight: 500;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing);
}

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 1rem 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.date-input {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
}

.currency-select {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Main content */
main {
    padding: 1rem 0;
}

.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1rem;
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cash-section, .stocks-section {
    margin-bottom: 1rem;
}

.cash-section:last-child, .stocks-section:last-child {
    margin-bottom: 0;
}

.cash-section h4, .stocks-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.cash-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.cash-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 60px;
}

.cash-input-row input[type="number"] {
    flex: 1;
    min-width: 100px;
}

.currency {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input[type="number"], input[type="text"] {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.stock-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 0.5rem;
    align-items: center;
}

.stock-input-group input[type="text"] {
    flex: 1;
    text-transform: uppercase;
    min-width: 80px;
}

.stock-input-group input[type="number"] {
    width: 80px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.stocks-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

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

.stock-info {
  display: grid;
  grid-template-columns: 80px 120px 40px 60px 80px 80px;
  gap: 12px;
  align-items: center;
  width: 100%;
}.stock-ticker {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.stock-amount {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

.stock-price {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

.stock-value {
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.stock-amount {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-remove {
    background: var(--error);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

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

.no-stocks {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
    font-size: 0.75rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.total-capital {
    margin-top: 6px;
    padding-top: 6px;
    font-weight: 600;
    color: var(--text-primary) !important;
}

.total-capital span:last-child {
    color: var(--text-primary);
}

.placeholder-content {
    min-height: 200px;
}

.suggestions-card, .performance-card {
    opacity: 1;
    position: relative;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    padding: 1rem 0;
}

footer p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.625rem;
}

/* Responsive design */
@media (max-width: 1024px) {
    .content {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .portfolio-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .card {
        padding: 0.75rem;
    }
    
    .cash-input-row, .stock-input-group {
        flex-wrap: wrap;
    }
    
    .logo {
        width: 28px;
        height: 28px;
    }
    
    header h1 {
        font-size: 1rem;
    }
}

/* Subtle animations */
@media (prefers-reduced-motion: no-preference) {
    * {
        transition: background-color 0.2s ease, opacity 0.2s ease;
    }
}

/* Cash display */
.cash-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.cash-label {
    font-weight: 600;
    color: var(--text-primary);
}

.cash-amount {
    font-weight: 600;
    color: var(--accent);
    font-size: 1.1em;
}

/* Table headers */
.table-headers {
    display: grid;
    grid-template-columns: 250px 270px 220px;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 4px;
}

.header-group {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-secondary);
    text-align: center;
    padding: 4px 0;
}

.positioner-header {
    grid-column: 1;
}

.rekommendation-header {
    grid-column: 2;
}

.innehav-header {
    grid-column: 3;
}

.column-headers {
    display: grid;
    grid-template-columns: 70px 110px 70px 90px 180px 60px 80px 80px;
    gap: 6px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.8em;
    color: var(--text-secondary);
    text-align: center;
}

.column-headers span {
    padding: 4px 0;
}

/* Stock items */
.stock-item {
    margin-bottom: 4px;
}

.stock-info {
    padding: 6px;
}

.stock-ticker {
    color: var(--accent);
}

.stock-price {
    color: var(--text-primary);
    font-weight: 600;
}

.stock-owned {
    color: var(--warning);
    font-weight: 600;
}

/* Total row */
.total-row {
    margin-top: 12px;
    padding-top: 8px;
}

.total-info {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 8px;
}

.total-info span:first-child {
    color: var(--accent);
    font-size: 1.1em;
}

.total-info span:nth-child(2) {
    color: var(--warning);
    font-size: 1.1em;
    text-align: center;
}

/* Cash row */
.cash-row {
    margin-top: 8px;
    padding-top: 8px;
}

.cash-info {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 8px;
}

.cash-info span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.cash-info span:nth-child(2) {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.1em;
}

/* Capital row */
/* Bulk Actions */
.bulk-actions-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.btn-bulk-action {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sell-all {
    background: var(--error);
    color: white;
}

.btn-sell-all:hover:not(:disabled) {
    background: #a94442;
    transform: translateY(-1px);
}

.btn-buy-all {
    background: var(--accent);
    color: white;
    opacity: 0.6;
}

.btn-buy-all:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-bulk-action:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* User Authentication */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-link {
    background: var(--accent);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.login-link:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User dropdown menu */
.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-dropdown-trigger:hover {
    background: var(--nord2);
    border-color: var(--nord8);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.user-dropdown-trigger:hover .dropdown-arrow {
    color: var(--nord8);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--nord8);
}

.user-email {
    color: var(--text-primary);
    font-weight: 500;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

/* Klickbara element */
.clickable {
    cursor: pointer;
    color: var(--nord8);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.clickable:hover {
    color: var(--nord13);
}

/* Modal för redigering av kontanter */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    min-width: 400px;
    max-width: 90vw;
}

.modal h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.modal-input {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.modal-input:focus {
    outline: none;
    border-color: var(--nord8);
}

.modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-btn-primary {
    background: var(--nord8);
    color: var(--bg-primary);
}

.modal-btn-primary:hover {
    background: var(--nord13);
}

.modal-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-btn-secondary:hover {
    background: var(--bg-tertiary);
}

.modal-btn-danger {
    background: var(--error);
    color: white;
}

.modal-btn-danger:hover {
    background: #a0424a;
    transform: translateY(-1px);
}

/* Settings modal */
.settings-modal {
    max-width: 450px;
    width: 90%;
}

.settings-section {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.settings-select {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-select:not(:disabled):hover {
    border-color: var(--nord8);
}

.settings-select:focus {
    outline: none;
    border-color: var(--nord8);
}

.settings-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    font-style: italic;
}

/* Market checkboxes */
.market-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.market-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    cursor: not-allowed;
    transition: all 0.2s ease;
}

.market-checkbox-item.disabled {
    opacity: 0.5;
}

.market-checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: inherit;
    flex-shrink: 0;
    position: relative;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
}

.market-checkbox-item input[type="checkbox"]:checked {
    background: var(--nord8);
    border-color: var(--nord8);
}

.market-checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--nord0);
    font-size: 14px;
    font-weight: bold;
}

.market-checkbox-item span {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Bank integration */
.bank-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bank-logo {
    height: 28px;
    opacity: 0.9;
}

.settings-connect-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: not-allowed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.settings-connect-btn:not(:disabled) {
    cursor: pointer;
}

.settings-connect-btn:not(:disabled):hover {
    border-color: var(--nord8);
    background: var(--nord2);
}

.coming-soon-badge {
    font-size: 0.75rem;
    color: var(--nord13);
    font-style: italic;
    font-weight: 500;
}

/* Delete account link */
.settings-delete-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem 0;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.settings-delete-link:hover {
    color: var(--error);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--nord8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 12px;
    height: 12px;
    border-width: 2px;
}

.spinner-large {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Page loading overlay */
.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 34, 39, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    gap: 1rem;
    transition: opacity 0.3s ease;
}

.page-loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.page-loading-text {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}