/* 13F Builder - Unified Design System */

:root {
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #dbeafe;
    --accent: #00D4AA;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #0A0F1C;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ========== Navigation ========== */
/* Use body > nav to only target the site header nav, not breadcrumbs etc */
body > nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--dark);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.925rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-links .nav-cta {
    background: var(--primary);
    color: #fff !important;
    margin-left: 0.5rem;
}

.nav-links .nav-cta:hover {
    background: var(--primary-dark);
}

/* ========== Main Content ========== */
main {
    flex: 1;
    padding: 6rem 2rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ========== Footer ========== */
footer {
    background: var(--dark);
    padding: 3rem 2rem 2rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-section h6 {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-section p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.6;
}

.footer-section a {
    display: block;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.25rem 0;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: #fff;
}

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

.footer-bottom p {
    color: var(--gray-500);
    font-size: 0.8rem;
    margin: 0;
}

/* Legacy footer links (for pages using old format) */
.footer-links a {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    margin-left: 1.5rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--dark);
    margin: 0 0 0.25rem;
}

.page-header p {
    color: var(--gray-500);
    margin: 0;
    font-size: 1rem;
}

/* ========== Cards ========== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

/* ========== Form Sections ========== */
.form-section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    color: var(--primary);
    font-size: 1.1rem;
}

/* ========== Form Controls ========== */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-control, .form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.925rem;
    transition: all 0.15s ease;
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.input-group-text {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ========== Buttons ========== */
.btn {
    font-weight: 500;
    font-size: 0.925rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
}

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

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

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

.btn-success:hover {
    background: #059669;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline-primary:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline-secondary:hover {
    background: var(--gray-50);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: var(--danger);
}

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

/* ========== Table ========== */
.table {
    font-size: 0.875rem;
    margin: 0;
}

.table th {
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
    padding: 0.75rem;
    background: var(--gray-50);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-responsive {
    max-height: 400px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
}

.cusip-cell {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.number-cell {
    text-align: right;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

/* ========== Search Results ========== */
.search-results {
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
}

.search-results .list-group-item {
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.1s ease;
}

.search-results .list-group-item:last-child {
    border-bottom: none;
}

.search-results .list-group-item:hover {
    background: var(--primary-light);
}

.cusip-badge {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* ========== Summary Stats ========== */
.summary-stat {
    text-align: center;
    padding: 0.75rem;
}

.summary-stat .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.summary-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

/* ========== Validation Status ========== */
.validation-status {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.validation-status.valid {
    background: #ecfdf5;
    color: #065f46;
}

.validation-status.invalid {
    background: #fef2f2;
    color: #991b1b;
}

.validation-status.pending {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ========== Empty State ========== */
.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* ========== CSV Import ========== */
.csv-drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.csv-drop-zone:hover,
.csv-drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.csv-drop-zone i {
    font-size: 2.5rem;
    color: var(--gray-400);
}

.csv-drop-zone p {
    color: var(--gray-600);
    margin: 0;
}

/* ========== Modal ========== */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

/* ========== Sticky Sidebar ========== */
.sticky-sidebar {
    position: sticky;
    top: 6rem;
}

/* ========== Badges ========== */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
}

/* ========== Utilities ========== */
.text-danger {
    color: var(--danger) !important;
}

.help-icon {
    color: var(--gray-400);
    cursor: help;
    font-size: 0.8rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    body > nav {
        padding: 1rem;
    }

    .nav-links a:not(.nav-cta) {
        display: none;
    }

    main {
        padding: 5rem 1rem 2rem;
    }

    .form-section {
        padding: 1rem;
    }

    .sticky-sidebar {
        position: relative;
        top: 0;
    }

    .summary-stat .value {
        font-size: 1.25rem;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-links a {
        margin: 0 0.75rem;
    }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
