:root {
    --primary: #4472C4;
    --primary-dark: #2e5296;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --light: #f8f9fa;
    --dark: #343a40;
    --border: #dee2e6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.logout-link {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
    text-decoration: none;
}

.logout-link:hover { color: white; text-decoration: underline; }

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Profile bar */
.profile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-bar-left,
.profile-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-bar label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary);
    white-space: nowrap;
}

.profile-bar select,
.profile-bar input[type="text"] {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

.profile-bar select { min-width: 160px; }
.profile-bar input[type="text"] { width: 160px; }

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

.btn-link.danger {
    color: var(--danger);
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--light);
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--secondary);
}

.tab-btn:hover {
    background: rgba(68, 114, 196, 0.1);
}

.tab-btn.active {
    color: var(--primary);
    background: white;
    border-bottom: 3px solid var(--primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.help-text {
    color: var(--secondary);
    margin-bottom: 1.5rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    margin-top: 0.25rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

/* Account/Event Cards */
.account-card,
.event-card,
.milestone-group {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.remove-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.3s;
}

.remove-btn:hover {
    background: #c82333;
}

.milestone-group {
    background: white;
    border-left: 4px solid var(--primary);
}

.milestone-item {
    background: var(--light);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(68, 114, 196, 0.3);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-link {
    background: none;
    color: var(--primary);
    padding: 0.5rem;
}

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

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--light);
    border-top: 2px solid var(--border);
}

.action-bar > div {
    display: flex;
    gap: 1rem;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 1rem;
    font-size: 1.2rem;
}

/* Results Page */
.dashboard {
    padding: 2rem;
    background: var(--light);
}

.scenario-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.scenario-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-item {
    text-align: center;
    padding: 1rem;
    background: var(--light);
    border-radius: 6px;
}

.summary-item .label {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Projections */
.projections {
    padding: 2rem;
}

.projection-controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--primary);
    color: white;
}

th, td {
    padding: 1rem;
    text-align: left;
}

tbody tr:nth-child(even) {
    background: var(--light);
}

tbody tr:hover {
    background: rgba(68, 114, 196, 0.1);
}

/* Insights */
.insights {
    padding: 2rem;
    background: var(--light);
}

.insight-card {
    background: white;
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.insight-card.warning {
    border-left-color: var(--warning);
}

.insight-card.success {
    border-left-color: var(--success);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 0;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        overflow-x: auto;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 1rem;
    }
}
