/* DEGIRO Portfolio - Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg);
}

/* Dropdown Navigation */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-toggle::after {
    content: '\25BC';
    font-size: 0.55em;
    opacity: 0.5;
    transition: transform 0.2s;
}

.nav-dropdown:hover .dropdown-toggle::after {
    transform: rotate(180deg);
    opacity: 1;
}

.dropdown-menu {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: calc(100% - 4px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 0.5rem 0;
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

/* Invisible bridge to prevent menu from closing */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.nav-dropdown:hover .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--primary);
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* User Link */
.user-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    border-radius: 20px;
    transition: all 0.2s;
    background: var(--bg);
}

.user-link:hover {
    background: var(--primary);
}

.user-link:hover .username {
    color: white;
}

.user-link:hover .user-avatar {
    background: white;
    color: var(--primary);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

/* Language Selector */
.lang-selector {
    display: flex;
    gap: 0.25rem;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.25rem;
}

.lang-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.lang-link:hover {
    color: var(--text);
}

.lang-link.active {
    background: var(--primary);
    color: white;
}

/* Auth Language Selector */
.auth-lang-selector {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.25rem;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.25rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    text-align: center;
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

.btn-large {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

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

/* Messages */
.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.success-message {
    background: #f0fdf4;
    color: var(--success);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.security-notice {
    background: #fffbeb;
    color: var(--warning);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    font-size: 0.75rem;
    text-align: left;
}

.info-box {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
}

.info-box p {
    margin-bottom: 1rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin: 0;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    text-align: center;
}

.card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.card-value-small {
    font-size: 1rem;
}

.card-value small {
    font-size: 0.875rem;
    font-weight: 400;
}

.summary-card.positive .card-value {
    color: var(--success);
}

.summary-card.negative .card-value {
    color: var(--danger);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.data-table tbody tr:hover {
    background: var(--bg);
}

.text-right {
    text-align: right;
}

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

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-buy {
    background: #dcfce7;
    color: var(--success);
}

.badge-sell {
    background: #fef2f2;
    color: var(--danger);
}

.badge-other {
    background: var(--bg);
    color: var(--text-muted);
}

/* Position Names */
.position-name {
    font-weight: 500;
}

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

/* Grids */
.dashboard-grid,
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

/* Sync Status */
.sync-status {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    background: var(--bg);
    font-size: 0.875rem;
}

.sync-status.success {
    background: #f0fdf4;
    color: var(--success);
}

.sync-status.error {
    background: #fef2f2;
    color: var(--danger);
}

/* Allocation */
.allocation-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.allocation-item {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    align-items: center;
    gap: 1rem;
}

.allocation-type {
    font-weight: 500;
    font-size: 0.875rem;
}

.allocation-value {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.allocation-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.allocation-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

/* Chart Container */
.chart-container {
    height: 300px;
    margin: 1rem 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid,
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .data-table-full {
        display: block;
        overflow-x: auto;
    }
}
