/* ==========================================
   COMPARISON PAGE STYLES
   ========================================== */

/* Main Container */
.comparison-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out;
}

.comparison-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #4a6fa5 0%, #5a9f68 50%, #d4a44c 100%);
}

.comparison-header {
    margin-bottom: 1rem;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.comparison-header h1 {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin: 0;
}

.comparison-intro {
    display: none; /* Hidden - moved to bottom of page */
}

.mobile-filter-btn {
    display: none; /* Hidden on desktop */
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    align-items: center;
    gap: 0.5rem;
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
}

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

.filter-icon {
    font-size: 1rem;
}

.filter-icon iconify-icon {
    font-size: 1rem;
    vertical-align: -0.1em;
}

.filter-count {
    background: #ff4444;
    color: white;
    border-radius: 50%;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* ==========================================
   COMPARISON LAYOUT (DESKTOP: SIDEBAR)
   ========================================== */
.comparison-layout {
    display: flex;
    gap: 1.5rem;
}

.comparison-main {
    flex: 1;
    min-width: 0; /* Prevent flex item overflow */
}

/* ==========================================
   COMPACT SPENDING INPUTS
   ========================================== */
.spending-inputs-compact {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f4f8 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 1.25rem;
}

.spending-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.spending-header-row h3 {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin: 0;
}

.toggle-inputs-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toggle-inputs-btn:hover {
    background: var(--card-bg);
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.toggle-icon {
    font-size: 0.6rem;
}

.inputs-panel {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.inputs-panel.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.compact-inputs-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.compact-input-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.25rem 0.35rem;
    transition: var(--transition-smooth);
}

.compact-input-item:hover,
.compact-input-item:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.08);
}

.compact-label {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.1rem;
    cursor: help;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-icon {
    font-size: 0.7rem;
    flex-shrink: 0;
}

.compact-input-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
}

.compact-currency {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--primary-color);
    flex-shrink: 0;
}

input.compact-number-input,
input.compact-number-input[type="text"] {
    width: 100%;
    border: none !important;
    background: transparent !important;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--secondary-color);
    padding: 0 !important;
    margin: 0;
    min-width: 0;
    box-shadow: none !important;
    outline: none;
    border-radius: 0 !important;
}

input.compact-number-input:focus,
input.compact-number-input[type="text"]:focus {
    outline: none;
    box-shadow: none !important;
}

.compact-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.compact-total {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.compact-total-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

.compact-total-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
}

.btn-compact {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* ==========================================
   RESULTS SECTION
   ========================================== */
.results-section {
    margin-bottom: 1.5rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.results-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.results-title h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    margin: 0 0 0.1rem 0;
}

.results-subtitle {
    color: var(--text-light);
    margin: 0;
    font-size: 0.8rem;
}

/* ==========================================
   DISPLAY MODE TOGGLE
   ========================================== */
.display-mode-toggle {
    display: flex;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef4 100%);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border-color);
}

.mode-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mode-btn:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-btn.active[data-mode="miles"] {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.mode-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: #1e40af;
}

.mode-info-icon {
    font-size: 1rem;
}

.mode-info-icon iconify-icon {
    font-size: 1.2rem;
    vertical-align: -0.15em;
}

.mode-info-text {
    flex: 1;
}

.inline-disclaimer {
    font-size: 0.7rem;
    color: var(--text-light);
    background: #fef3c7;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: help;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================
   CARD RANKINGS
   ========================================== */
.card-rankings {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ranking-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: var(--transition-smooth);
    position: relative;
}

.ranking-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.ranking-card.top-pick {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: var(--success-color);
}

.ranking-card.minimum-not-met {
    opacity: 0.7;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
}

.rank-badge {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50%;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef4 100%);
    color: var(--text-light);
    flex-shrink: 0;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
    color: #92400e;
    box-shadow: 0 3px 10px rgba(252, 211, 77, 0.4);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    color: #475569;
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #9a3412;
}

.ranking-card-image {
    width: 60px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ranking-card-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-info {
    display: flex;
    flex-direction: column;
    min-width: 160px;
    flex: 1;
}

.bank-name {
    font-size: 0.65rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.cashback-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    min-width: 100px;
    flex-shrink: 0;
}

.cashback-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success-color);
}

.cashback-amount.miles-amount {
    color: #1e40af;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cashback-amount.minimum-failed {
    color: var(--error-color);
    text-decoration: line-through;
}

.cashback-rate {
    font-size: 0.75rem;
    color: var(--text-light);
}

.cashback-rate.warning {
    color: var(--error-color);
    font-weight: 600;
}

.card-actions {
    flex-shrink: 0;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

.top-pick-badge {
    position: absolute;
    top: -7px;
    right: 12px;
    background: linear-gradient(135deg, var(--success-color) 0%, #4a8a55 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(90, 159, 104, 0.4);
}

/* ==========================================
   ASSUMPTIONS SECTION
   ========================================== */
.assumptions-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f4f8 100%);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
}

.assumptions-section h4 {
    color: var(--secondary-color);
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}

.assumptions-section p {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
}

.assumptions-section ul {
    margin-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.assumptions-section li {
    color: var(--text-color);
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}

.assumptions-note {
    font-style: italic;
    color: var(--text-light);
    padding-top: 0.4rem;
    border-top: 1px solid var(--border-color);
    margin-bottom: 0;
}

/* ==========================================
   RESPONSIVE - Tablet
   ========================================== */
@media (max-width: 1000px) {
    .compact-inputs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================
   RESPONSIVE - Mobile
   ========================================== */
@media (max-width: 600px) {
    .comparison-container {
        padding: 1rem;
    }
    
    .comparison-header h1 {
        font-size: 1.25rem;
    }
    
    .compact-inputs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .compact-input-item {
        padding: 0.25rem 0.3rem;
    }
    
    .compact-label {
        font-size: 0.55rem;
    }
    
    .compact-number-input {
        font-size: 0.85rem;
    }
    
    .compact-footer {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .compact-total-label {
        font-size: 0.7rem;
    }
    
    .compact-total-value {
        font-size: 0.85rem;
    }
    
    .btn-compact {
        padding: 0.35rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .results-header {
        flex-direction: column;
        gap: 0.35rem;
        margin-bottom: 0.5rem;
    }
    
    .results-header-right {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 0.5rem;
    }
    
    .display-mode-toggle {
        padding: 2px;
    }
    
    .mode-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .mode-info {
        font-size: 0.65rem;
        padding: 0.4rem 0.6rem;
    }
    
    .results-title h3 {
        font-size: 0.95rem;
    }
    
    .results-subtitle {
        font-size: 0.7rem;
    }
    
    .inline-disclaimer {
        align-self: flex-start;
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    .card-rankings {
        gap: 0.5rem;
    }
    
    /* Compact horizontal layout for mobile result cards */
    .ranking-card {
        padding: 0.5rem;
        gap: 0.5rem;
        flex-wrap: nowrap;
        cursor: pointer;
    }
    
    .rank-badge {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    
    .ranking-card-image {
        width: 40px;
        flex-shrink: 0;
    }
    
    .ranking-card-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.4rem;
        flex-wrap: nowrap;
        min-width: 0;
    }
    
    .card-info {
        min-width: 0;
        flex: 1;
    }
    
    .bank-name {
        font-size: 0.5rem;
    }
    
    .card-name {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .cashback-info {
        align-items: flex-end;
        text-align: right;
        flex-shrink: 0;
    }
    
    .cashback-amount {
        font-size: 0.95rem;
    }
    
    .cashback-rate {
        font-size: 0.6rem;
    }
    
    .card-actions {
        display: none;
    }
    
    .top-pick-badge {
        font-size: 0.5rem;
        padding: 0.1rem 0.35rem;
        top: -5px;
        right: 8px;
    }
    
    /* Assumptions section compact */
    .assumptions-section {
        padding: 0.5rem 0.75rem;
    }
    
    .assumptions-section h4 {
        font-size: 0.7rem;
    }
    
    .assumptions-section p,
    .assumptions-section li {
        font-size: 0.65rem;
    }
}

/* ==========================================
   FILTERS SIDEBAR
   ========================================== */
.filters-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 20px;
    box-shadow: var(--shadow-sm);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.filters-header h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    margin: 0;
}

.close-filters-btn {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    transition: var(--transition-smooth);
}

.close-filters-btn:hover {
    color: var(--primary-color);
}

.filters-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0;
}

.filter-help {
    font-size: 0.7rem;
    color: var(--text-light);
    margin: 0.25rem 0 0.5rem 0;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Income Input Styles */
.income-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: var(--transition-smooth);
    position: relative;
}

.income-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.15);
}

.income-currency {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-right: 0.5rem;
}

.income-filter-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-color);
    background: transparent;
    min-width: 0;
}

.income-filter-input::placeholder {
    color: #bbb;
}

.income-clear-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.25rem;
    transition: var(--transition-smooth);
}

.income-clear-btn:hover {
    background: var(--error-color);
    color: white;
}

.filter-checkbox,
.filter-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 5px;
    transition: var(--transition-smooth);
}

.filter-checkbox:hover,
.filter-radio:hover {
    background: var(--bg-light);
}

.filter-checkbox input[type="checkbox"],
.filter-radio input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.checkbox-label,
.radio-label {
    font-size: 0.85rem;
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
}

.filter-actions {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.filter-actions .btn {
    width: 100%;
    justify-content: center;
}

/* ==========================================
   MOBILE FILTERS (MODAL OVERLAY)
   ========================================== */
@media (max-width: 768px) {
    .comparison-header h1 {
        font-size: 1.2rem;
    }
    
    .mobile-filter-btn {
        display: flex;
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .comparison-layout {
        display: block;
    }
    
    /* Filters sidebar slides in from right */
    .filters-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        z-index: 1001;
        transition: right 0.3s ease;
        border-radius: 0;
        overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }
    
    .filters-sidebar.active {
        right: 0;
    }
    
    .close-filters-btn {
        display: block;
    }
}

/* Overlay background (separate element) */
.filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filters-overlay.active {
    display: block;
    opacity: 1;
}


/* ==========================================
   COMPARISON INFO/SEO SECTION
   ========================================== */
.comparison-info-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f4f8 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
}

.comparison-info-section h2 {
    font-size: 1.3rem;
    color: var(--secondary-color);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.info-item h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
}

.info-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.info-why {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.info-why h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    margin: 0 0 0.5rem 0;
}

.info-why p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .comparison-info-section {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }
    
    .comparison-info-section h2 {
        font-size: 1.1rem;
    }
}
