/* FIIT Index - Main Stylesheet */
/* Observatory Design — Sidebar Navigation */

/* ============================================
   GLOBAL STYLES
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #1a1a1a;
    line-height: 1.5;
    font-size: 15px;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 228px;
    background: #1a1028;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid rgba(255,255,255,0.04);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-logo {
    display: block;
    text-decoration: none;
}

.sidebar-logo-img {
    height: 38px;
    width: auto;
    display: block;
}

.sidebar-tagline {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.3);
    margin-top: 0.2rem;
    font-weight: 400;
    letter-spacing: 0.2px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.2);
    padding: 1rem 0.75rem 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover {
    color: rgba(255,255,255,0.8);
    background: #241838;
}

.sidebar-link.active {
    color: #fff;
    background: rgba(167,139,250,0.1);
}

.sidebar-link.active .sidebar-icon {
    opacity: 1;
}

.sidebar-icon {
    width: 17px;
    height: 17px;
    opacity: 0.6;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-cta {
    display: block;
    text-align: center;
    padding: 0.6rem;
    background: linear-gradient(135deg, #5a3d7a, #7c5faa);
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: 0.2px;
}

.sidebar-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(90,61,122,0.35);
}

/* Main content offset */
.main-content {
    margin-left: 228px;
    min-height: 100vh;
}

/* Mobile sidebar toggle */
.sidebar-mobile-toggle {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #1a1028;
    z-index: 999;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-mobile-toggle .mobile-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-mobile-toggle .mobile-logo-img {
    height: 34px;
    width: auto;
}

.sidebar-mobile-toggle .hamburger-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

/* Legacy header hidden - kept for any pages that still reference it */
header {
    display: none;
}

/* Legacy nav styles - keep for backward compat during transition */
.nav-link.nav-support {
    background: #7c3aed;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.5rem 1.15rem;
}

/* Mobile menu toggle - legacy */
.menu-toggle {
    display: none;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.875rem;
    color: #666;
    font-weight: 400;
}

/* ============================================
   CONTROLS BAR (Search, Filters, View Toggle)
   ============================================ */

.controls-bar {
    background: white;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid #e8e8e8;
}

.controls-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Search Box */
.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    background: #f8f9fa;
}

.search-box input:focus {
    outline: none;
    border-color: #5a3d7a;
    background: white;
    box-shadow: 0 1px 6px rgba(90, 61, 122, 0.1);
}

.search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
    opacity: 0.5;
}

/* Filter Dropdown */
.filter-group {
    min-width: 160px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.375rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9375rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.filter-group select:focus {
    outline: none;
    border-color: #5a3d7a;
    background-color: white;
    box-shadow: 0 1px 6px rgba(90, 61, 122, 0.1);
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 0.375rem;
    margin-left: auto;
    background: #f8f9fa;
    padding: 0.25rem;
    border-radius: 8px;
}

.view-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.125rem;
    transition: all 0.2s;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.view-btn:hover {
    background: #e8e8e8;
    color: #1a1a1a;
}

.view-btn.active {
    background: white;
    color: #5a3d7a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ============================================
   RESULTS INFO
   ============================================ */

.results-info {
    max-width: 1400px;
    margin: 1rem auto 0;
    padding: 0 2rem;
    color: #666;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   MAIN CONTENT CONTAINER
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

/* ============================================
   GRID VIEW
   ============================================ */

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.institution-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    border: 1px solid #f0f0f0;
}

.institution-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #e0e0e0;
}

.institution-card h3 {
    font-size: 1.0625rem;
    color: #1a1a1a;
    margin-bottom: 1rem;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: -0.3px;
    text-align: center;
}

.card-detail {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
    color: #666;
    text-align: center;
}

.card-detail .icon {
    width: 18px;
    margin-right: 0.5rem;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.investor-count {
    color: #5a3d7a;
    font-weight: 600;
}

.detail-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #1a1a1a;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid #e8e8e8;
}

.detail-link:hover {
    background: #5a3d7a;
    color: white;
    border-color: #5a3d7a;
}

.website-link {
    color: #5a3d7a;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

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

/* ============================================
   TABLE VIEW
   ============================================ */

.table-view {
    display: none;
    background: white;
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
    margin-top: 1.5rem;
}

/* Portfolio/Detail page table wrapper */
.portfolio-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.portfolio-table table {
    width: 100%;
    min-width: 400px;
    border-collapse: collapse;
}

.table-view.active {
    display: block;
}

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

thead {
    background: #f8f9fa;
    border-bottom: 1px solid #e8e8e8;
}

thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}

thead th:hover {
    background: #f0f0f0;
}

thead th.sortable::after {
    content: ' \21C5';
    opacity: 0.3;
    font-size: 0.75rem;
}

thead th.sorted-asc::after {
    content: ' \2191';
    opacity: 1;
    color: #5a3d7a;
}

thead th.sorted-desc::after {
    content: ' \2193';
    opacity: 1;
    color: #5a3d7a;
}

tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 1rem;
    color: #666;
    font-size: 0.9375rem;
}

.institution-name {
    color: #1a1a1a;
    font-weight: 600;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 968px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem 2rem;
    }
}

@media (max-width: 860px) {
    /* Sidebar becomes off-canvas on mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(.4,0,.2,1);
        z-index: 1001;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .sidebar-mobile-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding-top: 56px; /* mobile header height */
    }

    .controls-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle {
        margin-left: 0;
        justify-content: center;
    }
    
    .grid-view {
        grid-template-columns: 1fr;
    }
    
    .table-view {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-view table,
    .portfolio-table table {
        min-width: 500px;
    }
    
    /* Section card table overflow */
    .section-card {
        overflow-x: auto;
    }
    
    h1 {
        font-size: 1.25rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    /* Footer responsive */
    .footer-content {
        padding: 0 1rem;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem 1.5rem;
    }
    
    .footer-section:first-child {
        grid-column: 1 / -1;
    }

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

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

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

.no-results {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #999;
    font-size: 0.9375rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: #faf8ff;
    border-top: 1px solid #e8e4f0;
    margin-top: 4rem;
    padding: 1.15rem 0 1rem;
    text-align: center;
}

html {
    background: #faf8ff;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

.footer-sections {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.footer-section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.footer-section-label {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #c4bdd2;
}

.footer-section a {
    font-size: 0.76rem;
    color: #777;
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    transition: all 0.15s;
}

.footer-section a:hover {
    background: #ede9f6;
    color: #5a3d7a;
}

.footer-sep {
    width: 1px;
    height: 18px;
    background: #e8e4f0;
}

.footer-icons {
    display: flex;
    gap: 0.3rem;
}

.footer-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #ede9f6;
    color: #5a3d7a;
    text-decoration: none;
    transition: all 0.15s;
}

.footer-icon-link:hover {
    background: #ddd6f0;
    color: #5a3d7a;
    transform: translateY(-1px);
}

.footer-icon-link svg {
    width: 14px;
    height: 14px;
}

.footer-bottom {
    font-size: 0.66rem;
    color: #c4bdd2;
}

.footer-support-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: #5a3d7a;
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    transition: all 0.15s;
}

.footer-support-link:hover {
    background: #ede9f6;
    color: #5a3d7a;
}

.footer-support-link svg {
    width: 13px;
    height: 13px;
}

