:root {
    --primary: #00A651;
    --primary-dark: #008542;
    --ifb-accent: #f1c40f; /* Gold for Islamic Finance */
    --ifb-accent-dark: #cc9a06;
    --secondary: #005C42;
    --accent: #FFD700;
    --bg-dark: #0F172A;
    --bg-card: rgba(255, 255, 255, 0.08);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body.ifb-mode {
    --primary: var(--ifb-accent);
    --primary-dark: var(--ifb-accent-dark);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

.app-container {
    padding: 20px;
    padding-bottom: 120px; /* Space for comparison drawer */
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

.header h1 {
    font-size: 1.5rem;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), #00FF7F);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.ifb-mode .header h1 {
    background: linear-gradient(135deg, var(--ifb-accent), #FFE066);
    -webkit-background-clip: text;
}

.lang-selector {
    margin-top: 10px;
    display: flex;
    justify-content: center;
}

.lang-selector select {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.lang-selector select:hover {
    border-color: var(--primary);
}

.lang-selector select option {
    background: var(--bg-dark);
}

.model-toggle-container {
    display: flex;
    justify-content: center;
    padding: 0 20px;
    margin-bottom: 24px;
}

.model-switch {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 4px;
    border-radius: 50px;
    display: flex;
    position: relative;
    width: 300px;
    cursor: pointer;
}

.model-option {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
    color: var(--text-muted);
}

.model-option.active {
    color: #fff;
}

.ifb-mode .model-option.active {
    color: #000;
}

.model-slider {
    position: absolute;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--primary);
    border-radius: 50px;
    top: 4px;
    left: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.3);
}

.ifb-mode .model-slider {
    left: 50%;
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.3);
}

/* Search & Filters */
.filter-section {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
    position: sticky;
    top: 10px;
    z-index: 100;
}

.search-box {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.filter-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.filter-pill {
    padding: 6px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 166, 81, 0.4);
}

/* Loan Cards */
.loan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.loan-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.loan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.loan-card.selected {
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.05);
}

.loan-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.loan-section-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    display: block;
}

.loan-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-outline { background: var(--glass); border: 1px solid var(--glass-border); color: white; }

.compare-btn.active {
    background: var(--accent);
    color: #000;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-dark);
    width: 100%;
    max-width: 500px;
    border-radius: 24px 24px 0 0;
    padding: 30px 24px;
    animation: slideUp 0.3s ease-out;
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Comparison Drawer */
.compare-drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.compare-drawer.show { transform: translateY(0); }

.drawer-info {
    display: flex;
    flex-direction: column;
}

.drawer-title { font-weight: 600; font-size: 1rem; }
.drawer-sub { font-size: 0.8rem; color: var(--text-muted); }

/* Comparison Table */
.compare-table-container {
    overflow-x: auto;
    margin-top: 20px;
    -webkit-overflow-scrolling: touch;
}

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

.compare-table th {
    text-align: left;
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.compare-table td {
    padding: 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: inline-block;
}
