/* ============================================
   Halal Investment Filter Tool - Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS Variables ---- */
:root {
    --hif-primary: #0d7c5f;
    --hif-primary-light: #10a37f;
    --hif-primary-dark: #095c47;
    --hif-secondary: #1a73e8;
    --hif-halal-green: #0d9b6a;
    --hif-halal-green-bg: rgba(13, 155, 106, 0.08);
    --hif-halal-green-border: rgba(13, 155, 106, 0.2);
    --hif-haram-red: #dc3545;
    --hif-haram-red-bg: rgba(220, 53, 69, 0.08);
    --hif-haram-red-border: rgba(220, 53, 69, 0.2);
    --hif-warning: #f0ad4e;
    --hif-bg: #f0f4f3;
    --hif-card-bg: #ffffff;
    --hif-text: #1a2332;
    --hif-text-secondary: #5a6b7d;
    --hif-text-light: #8a95a5;
    --hif-border: #e2e8f0;
    --hif-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --hif-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.1);
    --hif-radius: 16px;
    --hif-radius-sm: 10px;
    --hif-radius-xs: 6px;
    --hif-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --hif-font: 'Cairo', sans-serif;
}

/* ---- Reset & Base ---- */
.hif-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hif-wrapper {
    font-family: var(--hif-font);
    direction: rtl;
    text-align: right;
    background: var(--hif-bg);
    color: var(--hif-text);
    padding: 0;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Hero Header ---- */
.hif-hero {
    background: linear-gradient(135deg, var(--hif-primary-dark) 0%, var(--hif-primary) 50%, var(--hif-primary-light) 100%);
    padding: 50px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 32px 32px;
    margin-bottom: 30px;
}

.hif-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: hif-float 8s ease-in-out infinite;
}

.hif-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
    animation: hif-float 10s ease-in-out infinite reverse;
}

@keyframes hif-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.05); }
}

.hif-hero-icon {
    font-size: 52px;
    margin-bottom: 12px;
    display: block;
    animation: hif-pulse 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

@keyframes hif-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.hif-hero h1 {
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hif-hero p {
    color: rgba(255,255,255,0.85);
    font-size: 16px;
    font-weight: 400;
    position: relative;
    z-index: 1;
    max-width: 550px;
    margin: 0 auto;
}

/* ---- Stats Bar ---- */
.hif-stats-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 28px;
    position: relative;
    z-index: 1;
}

.hif-stat-item {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--hif-radius-sm);
    padding: 14px 24px;
    text-align: center;
    min-width: 130px;
    transition: var(--hif-transition);
}

.hif-stat-item:hover {
    background: rgba(255,255,255,0.22);
    transform: translateY(-2px);
}

.hif-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.hif-stat-label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
    margin-top: 2px;
}

/* ---- Container ---- */
.hif-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---- Compliance Gauge ---- */
.hif-gauge-section {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.hif-gauge-card {
    background: var(--hif-card-bg);
    border-radius: var(--hif-radius);
    padding: 30px 40px;
    text-align: center;
    box-shadow: var(--hif-shadow);
    border: 1px solid var(--hif-border);
    min-width: 280px;
}

.hif-gauge-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--hif-text-secondary);
    margin-bottom: 20px;
}

.hif-gauge-ring {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 16px;
}

.hif-gauge-ring svg {
    transform: rotate(-90deg);
    width: 150px;
    height: 150px;
}

.hif-gauge-ring .bg-ring {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 10;
}

.hif-gauge-ring .fg-ring {
    fill: none;
    stroke: var(--hif-halal-green);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hif-gauge-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: 800;
    color: var(--hif-primary);
}

.hif-gauge-percent span {
    font-size: 16px;
    font-weight: 600;
}

.hif-gauge-label {
    font-size: 14px;
    color: var(--hif-text-secondary);
    font-weight: 500;
}

/* ---- Filter Section ---- */
.hif-filters {
    background: var(--hif-card-bg);
    border-radius: var(--hif-radius);
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--hif-shadow);
    border: 1px solid var(--hif-border);
}

.hif-filters-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.hif-filters-header-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--hif-primary-light), var(--hif-primary));
    border-radius: var(--hif-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.hif-filters-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--hif-text);
}

.hif-filters-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    align-items: end;
}

.hif-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hif-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--hif-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.hif-filter-label-icon {
    font-size: 14px;
}

.hif-search-wrapper {
    position: relative;
}

.hif-search-wrapper .hif-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--hif-text-light);
    pointer-events: none;
}

.hif-search-input {
    width: 100%;
    padding: 12px 42px 12px 16px;
    border: 2px solid var(--hif-border);
    border-radius: var(--hif-radius-sm);
    font-family: var(--hif-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--hif-text);
    background: var(--hif-bg);
    transition: var(--hif-transition);
    direction: rtl;
}

.hif-search-input::placeholder {
    color: var(--hif-text-light);
    font-weight: 400;
}

.hif-search-input:focus {
    outline: none;
    border-color: var(--hif-primary-light);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.1);
}

.hif-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--hif-border);
    border-radius: var(--hif-radius-sm);
    font-family: var(--hif-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--hif-text);
    background: var(--hif-bg);
    cursor: pointer;
    transition: var(--hif-transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-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 d='M6 8L1 3h10z' fill='%238a95a5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    direction: rtl;
}

.hif-select:focus {
    outline: none;
    border-color: var(--hif-primary-light);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.1);
}

/* ---- Results Count ---- */
.hif-results-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.hif-results-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--hif-text-secondary);
}

.hif-results-count strong {
    color: var(--hif-primary);
    font-weight: 800;
}

/* ---- Stock Cards Grid ---- */
.hif-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* ---- Single Stock Card ---- */
.hif-card {
    background: var(--hif-card-bg);
    border-radius: var(--hif-radius);
    padding: 0;
    box-shadow: var(--hif-shadow);
    border: 1px solid var(--hif-border);
    transition: var(--hif-transition);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: hif-card-in 0.5s ease forwards;
}

@keyframes hif-card-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hif-card:hover {
    box-shadow: var(--hif-shadow-hover);
    transform: translateY(-4px);
    border-color: var(--hif-primary-light);
}

.hif-card-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--hif-border);
}

.hif-card-company-info {
    flex: 1;
    min-width: 0;
}

.hif-card-company-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--hif-text);
    line-height: 1.4;
    margin-bottom: 6px;
}

.hif-card-ticker-sector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hif-card-ticker {
    background: var(--hif-bg);
    color: var(--hif-primary);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    border: 1px solid var(--hif-border);
}

.hif-card-sector {
    font-size: 12px;
    font-weight: 500;
    color: var(--hif-text-light);
}

/* ---- Compliance Badge ---- */
.hif-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 24px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--hif-transition);
}

.hif-badge-halal {
    background: var(--hif-halal-green-bg);
    color: var(--hif-halal-green);
    border: 1.5px solid var(--hif-halal-green-border);
}

.hif-badge-haram {
    background: var(--hif-haram-red-bg);
    color: var(--hif-haram-red);
    border: 1.5px solid var(--hif-haram-red-border);
}

.hif-badge-icon {
    font-size: 14px;
}

/* ---- Card Metrics ---- */
.hif-card-metrics {
    padding: 18px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.hif-metric {
    text-align: center;
    padding: 10px 4px;
    background: var(--hif-bg);
    border-radius: var(--hif-radius-xs);
    transition: var(--hif-transition);
}

.hif-card:hover .hif-metric {
    background: rgba(13, 124, 95, 0.04);
}

.hif-metric-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--hif-text-light);
    margin-bottom: 4px;
}

.hif-metric-value {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--hif-text);
}

/* ---- Card Footer (Sharia Rules) ---- */
.hif-card-footer {
    padding: 14px 24px;
    background: var(--hif-bg);
    border-top: 1px solid var(--hif-border);
}

.hif-sharia-rules {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hif-rule-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--hif-text-secondary);
}

.hif-rule-icon {
    font-size: 13px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.hif-rule-pass {
    color: var(--hif-halal-green);
}

.hif-rule-fail {
    color: var(--hif-haram-red);
}

/* ---- Tooltip ---- */
.hif-tooltip-trigger {
    position: relative;
    cursor: help;
    display: inline-flex;
    align-items: center;
}

.hif-tooltip-trigger .hif-tooltip-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hif-border);
    color: var(--hif-text-light);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    margin-right: 6px;
    flex-shrink: 0;
    transition: var(--hif-transition);
}

.hif-tooltip-trigger:hover .hif-tooltip-icon {
    background: var(--hif-primary);
    color: #fff;
}

.hif-tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 50%;
    transform: translateX(50%);
    background: var(--hif-text);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--hif-radius-sm);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.8;
    width: 260px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transition: var(--hif-transition);
    pointer-events: none;
}

.hif-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    border: 6px solid transparent;
    border-top-color: var(--hif-text);
}

.hif-tooltip-trigger:hover .hif-tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(50%) translateY(-4px);
}

/* ---- Sharia Info Banner ---- */
.hif-info-banner {
    background: var(--hif-card-bg);
    border-radius: var(--hif-radius);
    padding: 24px 28px;
    margin-bottom: 28px;
    box-shadow: var(--hif-shadow);
    border: 1px solid var(--hif-border);
    border-right: 4px solid var(--hif-primary);
}

.hif-info-banner-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--hif-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hif-info-rules-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.hif-info-rules-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--hif-text-secondary);
    padding: 8px 12px;
    background: var(--hif-bg);
    border-radius: var(--hif-radius-xs);
}

.hif-info-rules-list li .rule-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* ---- No Results ---- */
.hif-no-results {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.hif-no-results-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.6;
}

.hif-no-results-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--hif-text-secondary);
    margin-bottom: 8px;
}

.hif-no-results-sub {
    font-size: 14px;
    color: var(--hif-text-light);
}

/* ---- Footer ---- */
.hif-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--hif-text-light);
    font-size: 13px;
    font-weight: 500;
}

.hif-footer a {
    color: var(--hif-primary);
    text-decoration: none;
    font-weight: 600;
}

.hif-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 900px) {
    .hif-filters-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hif-filter-group:first-child {
        grid-column: 1 / -1;
    }

    .hif-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .hif-info-rules-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .hif-hero {
        padding: 36px 20px;
        border-radius: 0 0 24px 24px;
    }

    .hif-hero h1 {
        font-size: 24px;
    }

    .hif-hero p {
        font-size: 14px;
    }

    .hif-hero-icon {
        font-size: 40px;
    }

    .hif-stats-bar {
        gap: 10px;
    }

    .hif-stat-item {
        padding: 10px 16px;
        min-width: 100px;
    }

    .hif-stat-value {
        font-size: 22px;
    }

    .hif-stat-label {
        font-size: 11px;
    }

    .hif-filters {
        padding: 20px;
    }

    .hif-filters-grid {
        grid-template-columns: 1fr;
    }

    .hif-filter-group:first-child {
        grid-column: auto;
    }

    .hif-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .hif-card-header {
        padding: 16px 18px 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .hif-card-company-name {
        font-size: 15px;
    }

    .hif-card-metrics {
        padding: 14px 18px;
        gap: 8px;
    }

    .hif-metric {
        padding: 8px 4px;
    }

    .hif-metric-value {
        font-size: 13px;
    }

    .hif-metric-label {
        font-size: 10px;
    }

    .hif-card-footer {
        padding: 12px 18px;
    }

    .hif-gauge-card {
        padding: 24px 20px;
        min-width: auto;
        width: 100%;
    }

    .hif-gauge-ring {
        width: 120px;
        height: 120px;
    }

    .hif-gauge-ring svg {
        width: 120px;
        height: 120px;
    }

    .hif-gauge-percent {
        font-size: 28px;
    }

    .hif-info-banner {
        padding: 18px 20px;
    }

    .hif-tooltip-content {
        width: 220px;
        right: 0;
        transform: translateX(0);
    }

    .hif-tooltip-trigger:hover .hif-tooltip-content {
        transform: translateX(0) translateY(-4px);
    }

    .hif-tooltip-content::after {
        right: 16px;
        transform: none;
    }
}

/* ---- Card animation delays ---- */
.hif-card:nth-child(1) { animation-delay: 0.05s; }
.hif-card:nth-child(2) { animation-delay: 0.1s; }
.hif-card:nth-child(3) { animation-delay: 0.15s; }
.hif-card:nth-child(4) { animation-delay: 0.2s; }
.hif-card:nth-child(5) { animation-delay: 0.25s; }
.hif-card:nth-child(6) { animation-delay: 0.3s; }
.hif-card:nth-child(7) { animation-delay: 0.35s; }
.hif-card:nth-child(8) { animation-delay: 0.4s; }
.hif-card:nth-child(9) { animation-delay: 0.45s; }
.hif-card:nth-child(10) { animation-delay: 0.5s; }

/* ---- Skeleton loading ---- */
.hif-skeleton {
    animation: hif-skeleton-pulse 1.5s ease infinite;
}

@keyframes hif-skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Scrollbar ---- */
.hif-wrapper ::-webkit-scrollbar {
    width: 6px;
}

.hif-wrapper ::-webkit-scrollbar-track {
    background: var(--hif-bg);
}

.hif-wrapper ::-webkit-scrollbar-thumb {
    background: var(--hif-border);
    border-radius: 3px;
}

.hif-wrapper ::-webkit-scrollbar-thumb:hover {
    background: var(--hif-text-light);
}
