/* ═══════════════════════════════════════════════════════════
   ISLAMIC THEME — Global CSS Variables
═══════════════════════════════════════════════════════════ */
:root {
    --primary:        #1a472a;
    --primary-light:  #2d6a3e;
    --accent:         #d4af37;
    --accent-light:   #e8c547;
    --teal:           #0e6673;
    --bg:             #fafaf8;
    --card-bg:        rgba(255,255,255,0.88);
    --text-dark:      #1a1a1a;
    --text-light:     #666;
    --border:         rgba(0,0,0,0.08);
    --shadow:         0 10px 40px rgba(0,0,0,0.08);
    --radius:         20px;
    --transition:     all 0.35s cubic-bezier(0.23,1,0.32,1);
    --danger:         #dc2626;
    --danger-light:   #ef4444;

    /* Islamic geometric pattern (8-pointed star) — subtle overlay */
    --islamic-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cg fill='none' stroke='%231a472a' stroke-width='0.5' stroke-opacity='0.06'%3E%3Cpolygon points='40,4 52,28 78,28 57,44 65,70 40,55 15,70 23,44 2,28 28,28'/%3E%3Cpolygon points='40,14 49,33 70,33 53,46 59,67 40,54 21,67 27,46 10,33 31,33'/%3E%3C/g%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════════════════════
   BASE RESET
═══════════════════════════════════════════════════════════ */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: #fafaf8 !important;
    background-color: #fafaf8 !important;
    color: #1a1a1a !important;
    color-scheme: light only;
    /* Never allow mobile OS dark-mode to invert the page */
    -webkit-color-scheme: light;
}

a, .btn-link {
    color: var(--primary);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(26,71,42,0.35);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.topbar {
    height: 60px;
    background: white;
    border-bottom: 1px solid rgba(26,71,42,0.1);
    display: flex;
    align-items: center;
}

.layout-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    background: rgba(26,71,42,0.03);
    border-right: 1px solid rgba(26,71,42,0.08);
    transition: width 0.3s;
}

.sidebar.collapsed {
    width: 70px;
}

.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════
   NAV LINK ACTIVE STATE — Islamic green
═══════════════════════════════════════════════════════════ */
.nav-link.active {
    font-weight: 600;
    color: var(--primary) !important;
}

/* ═══════════════════════════════════════════════════════════
   FEEDBACK FAB — Islamic green/gold
═══════════════════════════════════════════════════════════ */
.feedback-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(26,71,42,0.35);
    z-index: 9999;
    transition: var(--transition);
}

.feedback-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 28px rgba(26,71,42,0.45);
}

/* ═══════════════════════════════════════════════════════════
   MAP MARKERS — Islamic green/gold
═══════════════════════════════════════════════════════════ */
.custom-marker {
    cursor: pointer;
}

.marker-pin {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(26,71,42,0.5);
    animation: pin-pulse 2s infinite;
}

@keyframes pin-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(26,71,42,0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(26,71,42,0); }
    100% { box-shadow: 0 0 0 0 rgba(26,71,42,0); }
}

.country-card:hover {
    background: rgba(26,71,42,0.04);
    transform: translateX(4px);
    transition: all 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════
   ISLAMIC GEOMETRIC UTILITY CLASSES
═══════════════════════════════════════════════════════════ */

/* Subtle Islamic star-pattern background overlay */
.islamic-pattern-bg {
    background-image: var(--islamic-pattern);
    background-size: 80px 80px;
}

/* Section divider with Islamic chain ornament */
.islamic-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 32px 0;
    color: var(--accent);
    opacity: 0.6;
}
.islamic-divider::before,
.islamic-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* Gold accent line for section headers */
.islamic-accent-line {
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    margin: 12px 0;
}

/* Card with Islamic top border gradient */
.islamic-card {
    position: relative;
    overflow: hidden;
}
.islamic-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR — Islamic green tint
═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(26,71,42,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(26,71,42,0.4); }

/* ═══════════════════════════════════════════════════════════
   MOBILE GLOBAL — touch, overflow, tap targets
═══════════════════════════════════════════════════════════ */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Prevent horizontal scroll on any page */
body {
    overflow-x: hidden;
}

/* Better tap targets on mobile */
button, a, [role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Inputs: prevent iOS auto-zoom (needs font-size >= 16px on focus) */
@media (max-width: 640px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Images should not overflow their container */
img {
    max-width: 100%;
    height: auto;
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL MOBILE READABILITY — light mode enforcement
   Ensures cards/containers are always readable regardless of
   which page background is active or what the OS theme is.
═══════════════════════════════════════════════════════════ */

/* All card-like surfaces: force readable background + text */
[class*="card"],
[class*="-card"],
[class*="panel"],
[class*="-panel"],
[class*="modal"],
[class*="-modal"],
[class*="section"],
[class*="-section"],
.join-card,
.hero-card,
.feature-card,
.step-card,
.stat-item,
.info-card,
.notif-card,
.welcome-card,
.stats-bar,
.stats-strip,
.jr-card,
.member-item,
.tree-card,
.empty-state-card,
.cn-search-box,
.cn-suggestions,
.chat-panel,
.fb-modal,
.bell-dropdown {
    color: #1a1a1a;
}

/* Heritage backgrounds — never go dark on mobile */
.heritage-bg,
.bg-fixed,
.bg-pattern {
    background-color: #f6f5f3 !important;
}

/* Gradient text: always provide a readable fallback colour.
   If -webkit-background-clip isn't supported the text shows green. */
.gradient,
.gradient-text,
.welcome-title,
.section-title,
.cn-title,
.page-title-gradient {
    color: #1a472a;
}

/* Ensure page containers have a light base so content is never
   rendered over a dark system background on any browser. */
@media (max-width: 640px) {
    html, body, #app, [id="app"] {
        background: #fafaf8 !important;
        background-color: #fafaf8 !important;
    }

    .dashboard-container,
    .cn-page,
    .join-container,
    .auth-shell,
    .tree-landing-container,
    .analytics-container,
    .community-container,
    .connect-page,
    .alb-shell,
    .gallery-shell,
    .admin-shell,
    main,
    .content {
        background-color: transparent;
        color: #1a1a1a;
    }

    /* Glass cards: raise opacity so semi-transparent bg is never unreadable */
    [style*="rgba(255,255,255,0.8"],
    [style*="rgba(255,255,255,0.7"] {
        background: rgba(255,255,255,0.97) !important;
    }

    /* Inputs: minimum contrast on all pages */
    input, select, textarea {
        background: #ffffff !important;
        color: #1a1a1a !important;
        border-color: rgba(0,0,0,0.15) !important;
    }

    /* Badges / pills: never transparent-on-dark */
    .badge, [class*="-badge"], [class*="-pill"], [class*="-chip"] {
        opacity: 1;
    }

    /* Any remaining gradient-text elements not yet converted to solid spans */
    [class*="gradient-text"],
    .page-title-gradient {
        -webkit-text-fill-color: #1a472a !important;
        background: none !important;
        -webkit-background-clip: unset !important;
        background-clip: unset !important;
        color: #1a472a !important;
    }
}
