/* ==========================================================================
   layout.css — Header & Footer styling for TheProfitEra
   Works in light & dark modes. Uses Inter font.
   ========================================================================== */

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
.main-header.navbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1e3a5f 100%);
    border-bottom: 1px solid rgba(96, 165, 250, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-height: 62px;
    padding: 0 10px;
}

.dark-mode .main-header.navbar {
    background: linear-gradient(135deg, #020617 0%, #0a0f1e 60%, #141b2d 100%);
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Brand area */
.main-header .navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.main-header .navbar-brand:hover {
    background: rgba(255, 255, 255, 0.06);
}

.main-header .navbar-brand img {
    height: 38px;
    width: 38px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.3);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.main-header .navbar-brand .brand-text {
    font-weight: 800;
    font-size: 1.22rem;
    background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.03em;
    line-height: 1;
}

.main-header .navbar-brand .brand-trademark {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    vertical-align: super;
    margin-left: 2px;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.4);
}

/* Market status badge in header */
.header-market-status {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    margin-left: 8px;
}

/* Live index chips in header (NIFTY 50 + SENSEX) */
.header-index-ticker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    flex-shrink: 1;
    overflow: hidden;
}

.header-index-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(96, 165, 250, 0.15);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.header-index-chip:hover {
    background: rgba(96, 165, 250, 0.1);
}

.header-index-name {
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-index-value {
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.header-index-change {
    font-size: 0.66rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 2px;
}

.header-index-change.positive {
    color: #4ade80;
}

.header-index-change.negative {
    color: #f87171;
}

.dark-mode .header-index-chip {
    background: rgba(20, 27, 45, 0.6);
    border-color: rgba(96, 165, 250, 0.12);
}

.header-market-status .status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: header-pulse 1.6s ease-in-out infinite;
}

.header-market-status.open {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.header-market-status.open .status-pulse {
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.header-market-status.closed {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.header-market-status.closed .status-pulse {
    background: #f87171;
    animation: none;
}

.header-market-status.preopen {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.header-market-status.preopen .status-pulse {
    background: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

@keyframes header-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* Nav links */
.main-header .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    font-weight: 600;
    font-size: 0.84rem;
    transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
    padding: 8px 14px !important;
    border-radius: 9px;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.main-header .nav-link:hover {
    color: #ffffff !important;
    background: rgba(96, 165, 250, 0.12);
    transform: translateY(-1px);
}

.main-header .nav-link.active {
    color: #ffffff !important;
    background: rgba(96, 165, 250, 0.18);
}

/* Theme toggle */
.main-header .theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.9rem;
}

.main-header .theme-toggle-btn:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    color: #ffffff;
    transform: rotate(15deg);
}

/* Login button */
.main-header .login-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3);
}

.main-header .login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(59, 130, 246, 0.45);
    color: #ffffff !important;
}

/* Dropdowns */
.main-header .dropdown-menu {
    border: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border-radius: 14px;
    padding: 8px;
    font-family: 'Inter', sans-serif;
    min-width: 200px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.dark-mode .main-header .dropdown-menu {
    background: #141b2d;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a3650;
}

.dark-mode .main-header .dropdown-item {
    color: #f1f5f9;
}

.dark-mode .main-header .dropdown-item:hover {
    background: #1a2336;
}

.dark-mode .main-header .dropdown-divider {
    border-color: #2a3650;
}

.main-header .dropdown-item {
    border-radius: 9px;
    padding: 9px 14px;
    font-weight: 600;
    font-size: 0.82rem;
    transition: background 0.15s ease, transform 0.15s ease;
}

.main-header .dropdown-item:hover {
    background: #f1f5f9;
    transform: translateX(3px);
}

.main-header .dropdown-item i {
    width: 18px;
    text-align: center;
}

/* User menu */
.user-menu .dropdown-menu {
    min-width: 260px;
}

.user-menu .user-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--card-border, #e2e8f0);
    text-align: center;
}

.dark-mode .user-menu .user-header {
    border-bottom: 1px solid #2a3650;
}

.user-menu .user-header img {
    border-radius: 50%;
    margin: 0 auto 8px;
    border: 2px solid rgba(96, 165, 250, 0.3);
}

.user-menu .user-header .user-welcome {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    margin: 0;
}

.user-menu .user-header .user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}

.dark-mode .user-menu .user-header .user-name {
    color: #f1f5f9;
}

/* Navbar user avatar (profile picture with initials fallback) */
.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.nav-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.nav-user-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
    margin: 0 auto 8px;
    border: 3px solid rgba(255, 255, 255, 0.15);
}

.dark-mode .nav-user-avatar {
    border-color: rgba(96, 165, 250, 0.2);
}

/* Refined right-side account menu */
.user-menu > .nav-link {
    margin-left: 8px;
    padding: 5px 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    gap: 8px;
}

.user-menu > .nav-link::after {
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.55);
    vertical-align: middle;
}

.user-menu > .nav-link:hover,
.user-menu.show > .nav-link {
    background: rgba(96, 165, 250, 0.18);
    border-color: rgba(96, 165, 250, 0.35);
    transform: none;
}

.user-menu > .nav-link > .font-weight-bold {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.76rem;
}

.user-menu .dropdown-menu {
    margin-top: 10px;
    padding: 0 7px 7px;
    overflow: hidden;
}

.user-menu .dropdown-menu::before {
    content: "";
    display: block;
    height: 3px;
    margin: 0 -7px 0;
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6);
}

.user-menu .user-header {
    padding: 20px 16px 17px;
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.08), rgba(124, 58, 237, 0.08));
}

.dark-mode .user-menu .user-header {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.18), rgba(124, 58, 237, 0.16));
}

.user-menu .user-header .user-welcome {
    margin-top: 2px;
    letter-spacing: 0.02em;
}

.user-menu .user-header .user-name {
    margin-top: 3px;
}

.user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
}

.user-menu .dropdown-item i {
    color: #2563eb;
}

.dark-mode .user-menu .dropdown-item i {
    color: #60a5fa;
}

/* Fixed header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    width: 100%;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: rgba(255, 255, 255, 0.7);
    border-top: 1px solid rgba(96, 165, 250, 0.2);
    font-family: 'Inter', sans-serif;
    padding: 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.main-footer.footer-visible {
    transform: translateY(0);
}

.dark-mode .main-footer {
    background: linear-gradient(135deg, #020617 0%, #0a0f1e 100%);
    border-top: 1px solid rgba(96, 165, 250, 0.12);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 24px;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}

.footer-brand strong {
    color: #ffffff;
    font-weight: 700;
}

.footer-brand .footer-tm {
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.35);
    vertical-align: super;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.74rem;
    font-weight: 500;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.footer-links a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.footer-social a:hover {
    background: rgba(96, 165, 250, 0.2);
    color: #ffffff;
    transform: translateY(-2px);
}

.footer-disclaimer {
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    padding: 4px 24px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Content stays between fixed header & footer */
.content-wrapper {
    padding-top: 62px;
    padding-bottom: 80px;
    min-height: calc(100vh - 62px - 80px);
    background: var(--page-bg, #f0f2f5);
    overflow-x: hidden;
    transition: background 0.3s ease;
}

.dark-mode .content-wrapper {
    background: #0a0f1e;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .header-market-status {
        display: none;
    }

    .footer-inner {
        padding: 8px 14px;
        gap: 8px;
    }

    .footer-links {
        gap: 2px;
    }

    .footer-links a {
        padding: 3px 6px;
        font-size: 0.7rem;
    }

    .footer-disclaimer {
        padding: 4px 14px 6px;
        font-size: 0.6rem;
    }

    .footer-social {
        display: none;
    }

    .content-wrapper {
        padding-top: 52px;
        padding-bottom: 90px;
    }
}
