/* ============================================================
   NIRMALA ASTROLOGY — PRO FULL-WIDTH PORTAL LAYOUT (v3.0)
   Clean software-grade collapsible sidebar + sticky topbar
   + Light (Logo) & Dark themes + Modern cards & widgets
   ============================================================ */

:root {
    --primary: #C62828;
    --primary-dark: #9E1C1C;
    --primary-soft: rgba(198, 40, 40, 0.09);
    --maroon: #5B151B;
    --gold: #F6C400;
    --gold-dark: #9A7400;
    --page-bg: #FCF8F0;
    --surface: #FFFFFF;
    --surface-soft: #FAF2E1;
    --border: #E9DDD2;
    --ink: #24191A;
    --muted: #6E5B5D;
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 62px;
    --sidebar-bg: #FFFFFF;
    --sidebar-border: #EAE0D6;
    --topbar-bg: rgba(255, 255, 255, 0.94);
    --card-shadow: 0 2px 10px rgba(91, 21, 27, 0.06);
    --card-shadow-hover: 0 10px 24px rgba(91, 21, 27, 0.11);
    --live-row-bg: rgba(246, 196, 0, 0.22);
}

[data-theme="dark"] {
    --primary: #EF5350;
    --primary-dark: #D32F2F;
    --primary-soft: rgba(239, 83, 80, 0.16);
    --maroon: #FDE8C8;
    --gold: #F6C400;
    --gold-dark: #FFD54F;
    --page-bg: #0E111B;
    --surface: #161A29;
    --surface-soft: #1E2336;
    --border: #2A314A;
    --ink: #EDF1F8;
    --muted: #9BA6C0;
    --sidebar-bg: #121624;
    --sidebar-border: #242B42;
    --topbar-bg: rgba(18, 22, 36, 0.94);
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    --card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.48);
    --live-row-bg: rgba(246, 196, 0, 0.16);
}

/* Base Reset */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body.portal-body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background-color: var(--page-bg) !important;
    color: var(--ink) !important;
    overflow-x: hidden;
    font-size: 0.92rem;
    line-height: 1.5;
}

/* Dark theme overrides for Bootstrap components */
[data-theme="dark"] .card,
[data-theme="dark"] .glass-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item {
    background-color: var(--surface) !important;
    color: var(--ink) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .dropdown-item { color: var(--ink) !important; }
[data-theme="dark"] .dropdown-item:hover { background-color: var(--surface-soft) !important; color: var(--gold) !important; }
[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    color: var(--ink);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text {
    background-color: #1D2235 !important;
    color: var(--ink) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white {
    background-color: var(--surface-soft) !important;
    color: var(--ink) !important;
}
[data-theme="dark"] .text-dark { color: var(--ink) !important; }
[data-theme="dark"] .text-muted { color: var(--muted) !important; }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Compact refined primary button */
.portal-body .btn-gold {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border: 1px solid var(--primary) !important;
    color: #FFFFFF !important;
    font-weight: 600;
    border-radius: 9px !important;
    padding: 0.45rem 1rem !important;
    text-transform: none !important;
    letter-spacing: 0.01em !important;
    font-size: 0.85rem !important;
    box-shadow: 0 3px 10px rgba(198, 40, 40, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.portal-body .btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(198, 40, 40, 0.30);
    color: #FFFFFF !important;
}
.portal-body .btn-gold.btn-sm {
    padding: 0.36rem 0.82rem !important;
    font-size: 0.8rem !important;
}

/* ============================================================
   SHELL LAYOUT: FIXED LEFT SIDEBAR + FULL-WIDTH MAIN WORKSPACE
   ============================================================ */
.portal-shell {
    display: flex !important;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.portal-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-width) !important;
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border) !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1045 !important;
    box-shadow: 2px 0 14px rgba(91, 21, 27, 0.04);
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.portal-sidebar-brand {
    height: var(--topbar-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.portal-brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 8px;
}

.portal-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
}

.portal-brand-text .brand-title {
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--maroon);
    letter-spacing: -0.01em;
}

.portal-brand-text .brand-sub {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 500;
}

.portal-sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 10px 18px;
    scrollbar-width: thin;
}

.portal-nav-group-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 14px 10px 5px;
    white-space: nowrap;
    overflow: hidden;
}

.portal-nav-group-admin {
    color: var(--primary);
}

.portal-nav-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px;
}

.portal-nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 11px;
    padding: 8px 11px;
    border-radius: 9px;
    color: var(--ink) !important;
    text-decoration: none !important;
    font-size: 0.84rem;
    font-weight: 500;
    transition: background-color 0.14s ease, color 0.14s ease;
    white-space: nowrap;
}

.portal-nav-link:hover {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
}

.portal-nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.24);
}

.portal-nav-icon {
    font-size: 1.02rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.9;
}

.portal-nav-link.active .portal-nav-icon {
    opacity: 1;
}

.portal-nav-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-nav-lock {
    font-size: 0.7rem;
    color: var(--gold-dark);
    flex-shrink: 0;
}

.portal-nav-link.active .portal-nav-lock {
    color: var(--gold);
}

.portal-sidebar-footer {
    padding: 12px 12px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.portal-tier-pill {
    padding: 7px 10px;
    border-radius: 9px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--maroon);
}

/* Collapsed Desktop Sidebar (Icon-only + Tooltips) */
.portal-shell.sidebar-collapsed .portal-sidebar {
    width: var(--sidebar-collapsed-width) !important;
}
.portal-shell.sidebar-collapsed .portal-sidebar-brand {
    justify-content: center;
    padding: 0 8px;
}
.portal-shell.sidebar-collapsed .portal-brand-text,
.portal-shell.sidebar-collapsed .portal-nav-label,
.portal-shell.sidebar-collapsed .portal-nav-group-label,
.portal-shell.sidebar-collapsed .portal-nav-lock {
    display: none !important;
}
.portal-shell.sidebar-collapsed .portal-nav-link {
    justify-content: center !important;
    padding: 10px 0 !important;
}
.portal-shell.sidebar-collapsed .portal-main {
    margin-left: var(--sidebar-collapsed-width) !important;
}

/* Main Content Area */
.portal-main {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar-width) !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh;
    transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sticky Pro Topbar */
.portal-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    height: var(--topbar-height);
    background: var(--topbar-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 22px;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
}

.btn-icon-ghost {
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--ink) !important;
    border-radius: 9px !important;
    width: 36px;
    height: 36px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-icon-ghost:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.btn-icon-pill,
.btn-location-pill,
.btn-user-pill {
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--ink) !important;
    border-radius: 999px !important;
    font-size: 0.82rem !important;
    font-weight: 500;
    padding: 5px 13px !important;
    height: 36px;
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    text-decoration: none !important;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-icon-pill:hover,
.btn-location-pill:hover,
.btn-user-pill:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.user-avatar-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
}

.portal-quota-badge {
    background: var(--surface-soft);
    color: var(--maroon);
    border: 1px solid var(--border);
    padding: 6px 11px;
    font-weight: 600;
    font-size: 0.76rem;
}

.portal-content {
    flex: 1 1 auto;
    padding: 20px 24px 36px !important;
    width: 100%;
    max-width: 100%;
}

.portal-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 14px 24px;
    color: var(--muted);
}
.portal-footer a {
    color: var(--muted);
    text-decoration: none;
}
.portal-footer a:hover {
    color: var(--primary);
}

/* Mobile Off-Canvas Sidebar (< 992px) */
.portal-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 26, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1040;
}

@media (max-width: 991.98px) {
    .portal-sidebar {
        transform: translateX(-100%);
        width: 272px !important;
    }
    .portal-shell.sidebar-mobile-open .portal-sidebar {
        transform: translateX(0);
    }
    .portal-shell.sidebar-mobile-open .portal-sidebar-backdrop {
        display: block;
    }
    .portal-main,
    .portal-shell.sidebar-collapsed .portal-main {
        margin-left: 0 !important;
    }
    .portal-topbar {
        padding: 0 12px;
    }
    .portal-content {
        padding: 14px 12px 26px !important;
    }
}

/* ============================================================
   PRO CARDS, 12-RASHI STRIP, LIVE PANCHANG & 3D MANTRA CARD
   ============================================================ */
.portal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    padding: 20px;
}

a.portal-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--card-shadow-hover);
}

/* 12-Rashi Horizontal Strip / Responsive Grid */
.rashi-strip {
    display: grid;
    grid-template-columns: repeat(12, minmax(92px, 1fr));
    gap: 10px;
}
@media (max-width: 1499.98px) {
    .rashi-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .rashi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.rashi-mini-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    text-decoration: none !important;
    color: var(--ink) !important;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.rashi-mini-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--card-shadow-hover);
    color: var(--primary) !important;
}
.rashi-symbol {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 6px;
}
.rashi-name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
}
.rashi-sub {
    font-size: 0.67rem;
    color: var(--muted);
    margin-top: 2px;
}

/* Live Panchang Tiles & Active Highlight */
.panchang-metric-tile {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 11px 13px;
    height: 100%;
}
.panchang-metric-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 2px;
}
.panchang-metric-val {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--maroon);
}
.panchang-live-row {
    background: var(--live-row-bg) !important;
    border-color: var(--gold) !important;
    box-shadow: inset 3px 0 0 var(--primary);
}

/* 3D Interactive Mantra Flip Card */
.mantra-flip-scene {
    perspective: 1200px;
    width: 100%;
    min-height: 300px;
    cursor: pointer;
}
.mantra-flip-card {
    position: relative;
    width: 100%;
    min-height: 300px;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.mantra-flip-card.is-flipped {
    transform: rotateY(180deg);
}
.mantra-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}
.mantra-face-front {
    background: linear-gradient(145deg, #5B151B 0%, #8E1F24 55%, #B82928 100%);
    color: #FFF8E7;
    border-color: rgba(246, 196, 0, 0.25);
}
.mantra-face-back {
    background: var(--surface);
    color: var(--ink);
    transform: rotateY(180deg);
}
.mantra-sanskrit {
    font-size: 1.22rem;
    font-weight: 600;
    line-height: 1.55;
    color: #FFE082;
}

/* Premium Blurred Lock Overlay */
.premium-blur-lock {
    position: relative;
    border: 1px dashed var(--gold-dark);
    border-radius: 14px;
    padding: 24px 18px;
    overflow: hidden;
    background: var(--surface-soft);
    min-height: 165px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.premium-blur-placeholder {
    position: absolute;
    inset: 16px;
    filter: blur(5px);
    opacity: 0.3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.placeholder-line {
    height: 14px;
    border-radius: 6px;
    background: var(--muted);
}
.premium-lock-cta {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 380px;
}
.premium-lock-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    margin-bottom: 8px;
}
