/*
 * BASE STYLES - Wealth Portal 2
 * ==============================
 * Reset and sensible defaults.
 * Uses tokens from tokens.css.
 *
 * Last updated: 2024-12-11
 */

/* ========================================
   RESET
   ======================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-background);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
    margin-bottom: var(--space-4);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

small {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

strong {
    font-weight: var(--font-weight-semibold);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

input::placeholder, textarea::placeholder {
    color: var(--color-text-tertiary);
}

/* ========================================
   LISTS
   ======================================== */

ul, ol {
    list-style: none;
}

/* ========================================
   IMAGES
   ======================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   TABLES
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
}

th {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    /* Sentence case - client-first, softer headers system-wide */
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text colors */
.text-primary { color: var(--color-text); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-tertiary); }

/* Text sizes */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

/* Font weights */
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Spacing helpers */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }

/* Display */
.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========================================
   SHELL NAV ITEMS (global so they apply to NavLink)
   ======================================== */

.shell-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    text-decoration: none;
    transition: all var(--transition-normal);
}

.shell-nav-item i {
    width: 20px;
    text-align: center;
}

.shell-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.shell-nav-item.active {
    background: rgba(59, 130, 246, 0.2);
    color: white;
    font-weight: var(--font-weight-medium);
    border-left: 3px solid #3b82f6;
    padding-left: calc(var(--space-3) - 3px);
}

/* ========================================
   USER MENU DROPDOWN (global)
   ======================================== */

.shell-user-menu {
    position: relative;
}

.shell-user-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.shell-user-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.dark-topbar .shell-user-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.shell-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: white;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--color-primary), #2563eb);
}

.shell-user-avatar.avatar-adviser {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.shell-user-avatar.avatar-client {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.shell-user-avatar.avatar-admin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.shell-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

.shell-user-chevron {
    font-size: 10px;
    color: var(--topbar-text);
    opacity: 0.6;
}

.shell-dropdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.shell-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 100;
    overflow: hidden;
}

.shell-dropdown-header {
    padding: 12px 16px;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border-light);
}

.shell-dropdown-name {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    color: var(--color-text);
}

.shell-dropdown-role {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.shell-dropdown-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 0;
}

.shell-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: background 0.1s ease;
}

.shell-dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--color-text-secondary);
}

.shell-dropdown-item:hover {
    background: var(--color-background);
}

.shell-dropdown-item.shell-dropdown-logout {
    color: var(--color-error);
}

.shell-dropdown-item.shell-dropdown-logout i {
    color: var(--color-error);
}

/* ========================================
   SCROLLBAR (subtle, matches dark nav)
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.5);
}
