/* header.css - Centralized, Sleek & Modern Header Styling */

/* Base Header Container */
header {
    background-color: #2c3e50; /* Deep charcoal / nearly black for a sleek look */
    color: #ecf0f1; /* Off-white for high contrast and readability */
    padding: 12px 30px; /* Comfortable vertical padding, generous horizontal */
    display: flex;
    flex-direction: column; /* Changed to column to stack content-wrapper and token-status */
    align-items: center; /* Center items horizontally when stacked */
    box-shadow: 0 3px 8px rgba(0,0,0,0.25); /* More prominent, soft shadow for depth */
    position: relative; /* Essential for absolutely positioned token status */
    width: 100%; /* Ensures header spans full width */
    z-index: 100; /* Keeps header on top of other content */
    box-sizing: border-box; /* Include padding in element's total width */
    min-height: 60px; /* Ensure a minimum height for consistency */
    padding-bottom: 30px; /* FIX: Added padding-bottom to create space for token-status bar */
}

/* New: Wrapper for the main horizontal header content (logo, title, nav, profile) */
.header-content-wrapper {
    display: flex;
    justify-content: space-between; /* Spreads left and right sections */
    align-items: center;
    width: 100%; /* Take full width of header */
    max-width: 1400px; /* Limit max width of content */
    padding-bottom: 5px; /* Small padding before token status if it's below */
    z-index: 2; /* Position above the token-status bar */
    position: relative; /* Needed for z-index to work */
    /* FIX: REMOVED background-color here - it should be transparent */
    background-color: transparent;
}

/* Header Inner Container (if used, e.g., in accountManagement.html) */
header .header-inner {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ecf0f1;
    z-index: 2;
    position: relative;
    /* FIX: REMOVED background-color here */
    background-color: transparent;
}

/* Header Main Content Wrapper (from loanAssignment.css, if present) */
.header-main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 2;
    position: relative;
    /* FIX: REMOVED background-color here */
    background-color: transparent;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Branding Section (Logo + Title) - Left Side */
.header-container {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2;
    position: relative;
}
.branding {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2;
    position: relative;
}

/* Logo Styling */
.branding .logo,
.header-container .logo,
header .logo {
    height: 38px;
    width: auto;
    margin: 0;
    flex-shrink: 0;
}
.header-container img {
    height: 38px;
    margin: 0;
}


/* Main Page Title (e.g., "Popcorn Dashboard") */
header h1,
header h2,
header h3 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
    color: #ecf0f1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    z-index: 2;
    position: relative;
    background-color: transparent;
}

/* New: Wrapper for Navigation and User Profile - Right Side */
.header-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 2;
    position: relative;
}

/* Top Navigation Links (e.g., Dashboard, Generate Token, Account Manager) */
.top-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 2;
    position: relative;
}

.top-nav a {
    color: #aeb6bf;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 4px;
    transition: color 0.3s ease, background-color 0.3s ease;
    white-space: nowrap;
    position: relative;
    z-index: 2;
    background-color: transparent;
}

/* Pipe Separator for Top Nav Links */
.top-nav a:not(:last-child)::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 1.2em;
    background-color: rgba(255, 255, 255, 0.3);
    margin-left: 20px;
    vertical-align: middle;
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.top-nav a:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

/* User Profile Section (e.g., Logout link) */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ecf0f1;
    z-index: 2;
    position: relative;
}

.user-profile a {
    color: #aeb6bf;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s ease;
    white-space: nowrap;
    z-index: 2;
    background-color: transparent;
}

.user-profile a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Bearer Token Status Display at the bottom of the header */
.token-status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 15px;
    background-color: rgba(33, 48, 31, 0.2); /* Semi-transparent background */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8em;
    font-weight: normal;
    color: #f0f0f0;
    letter-spacing: 0.01em;
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 1; /* Explicitly below main content */
}

.token-status span {
  display: inline-flex;
  align-items: center;
  font-weight: normal;
}

.token-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  box-shadow: 0 0 3px rgba(0,0,0,0.4);
}
.token-status .status-dot.active { background-color: #28a745; }
.token-status .status-dot.inactive { background-color: #dc3545; }

.token-status .active { color: #87e497; }
.token-status .inactive { color: #ff8585; }

.token-status input[type="checkbox"].concept-mode-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}

.token-status label[for="conceptMode"] {
  font-size: 0.75em;
  color: #f0f0f0;
  margin-left: 3px;
  vertical-align: middle;
  font-weight: normal;
}

/* Environment Support Label (e.g., "P/C", "P") */
.env-support-label {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.15);
  color: #aeb6bf;
  font-size: 0.7em;
  font-weight: normal;
  border-radius: 8px;
  padding: 2px 7px;
  margin-left: 10px;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* General Link Styling (catch-all for any other links in header not in specific navs) */
header a {
    color: #aeb6bf;
    text-decoration: none;
    transition: color 0.3s ease;
    z-index: 2;
    position: relative;
    background-color: transparent;
}
header a:hover {
    color: #ffffff;
    text-decoration: none;
}

/* General reset for headings to ensure consistency within HTML where header.css is used */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5em;
    color: #333;
    text-decoration: none;
    z-index: 2;
    position: relative;
    background-color: transparent;
}

/* Responsive adjustments for header */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
        gap: 10px;
    }
    .header-content-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .header-container, .header-nav-wrapper {
        width: 100%;
        justify-content: center;
        text-align: center;
        flex-wrap: wrap;
    }
    .top-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 5px;
    }
    .top-nav a {
        padding-right: 10px;
    }
    .top-nav a:not(:last-child)::after {
        content: none;
    }
    .user-profile {
        position: static;
        width: 100%;
        justify-content: center;
        margin-top: 5px;
        gap: 10px;
    }
    .token-status {
        position: static;
        width: 100%;
        padding: 8px 15px;
        margin-top: 10px;
        border-top: none;
        border-radius: 0;
        background-color: rgba(33, 48, 31, 0.35);
    }
}