/* --- Global Variables (Sets the light theme and colors) --- */
:root{
    --bg:#f2f2f2;       /* Light background for the overall page */
    --card:#ffffff;     /* White cards */
    --text:#333333;     /* Dark primary text */
    --muted:#666666;    /* Gray text */
    --accent:#b31b1b;   /* Deep Red for accents */
    --nav-bg: #333333;  /* Dark background for the nav bar */
}

/* --- Base & Reset --- */
*{box-sizing:border-box}
html,body{height:100%}
body{
    margin:0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background:var(--bg);
    color:var(--text);
}

/* --- Global Link Styling (FIXES THE UNDERLINE AND BLUE COLOR) --- */
a {
    color: var(--text); /* Forces link color to dark text, overriding browser default blue */
    text-decoration: none; /* <-- This removes the underline everywhere */
    transition: color 0.2s;
}
a:hover {
    text-decoration: underline; /* Adds underline only on hover for feedback */
    color: var(--accent); /* Changes link color to red on hover */
}

/* --- Container (Main Content Wrapper) --- */
.container{
    max-width: 1400px; /* Set a max-width to center content */
    width: 90%;
    margin:0 auto;
    padding:24px;
    background-color: var(--bg);
}

/* --- Header Top Bar (New Style) --- */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 0; 
}
.header-top a {
    text-decoration: none; /* Ensures no underline in the top bar links */
    color: inherit;
}
.header-utilities {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}
.cta-request, .cta-chat {
    padding: 8px 15px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.cta-request {
    background: transparent;
    color: var(--accent);
}
.cta-chat {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* --- Main Navigation Bar (New Style) --- */
.main-nav-bar {
    background-color: var(--nav-bg); 
    /* Extends the nav bar full width within the container padding */
    margin: 20px -24px 30px -24px; 
    padding: 0 24px;
}
.main-nav-bar ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}
.main-nav-bar li a {
    display: block;
    color: white; /* Links in the nav bar are white */
    padding: 15px 20px;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.2s;
}
.main-nav-bar li a:hover {
    background-color: #555;
}

/* --- Original Portal Grid and Card Styles (Updated for Light Theme) --- */
.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); 
    gap:20px;
    margin-top: 20px;
}
.card{
    background:var(--card); /* Now white background */
    border:1px solid #ddd;
    border-radius:8px;
    padding:20px;
    transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover{
    transform:translateY(-2px);
    border-color:var(--accent); /* Highlight on hover */
    box-shadow:0 6px 15px rgba(0,0,0,.1);
}
.card h2{
    margin:0 0 8px;
    font-size:20px;
    color: var(--text);
}
.card p{
    margin:0;
    color:var(--muted);
    font-size:14px;
    line-height:1.4;
}
.card a{
    color:inherit;
    text-decoration:none; 
    display:block;
}

/* --- Content Headers & Footer --- */
.section-title{
    margin:20px 0 12px;
    font-size: 2.2em;
    color: var(--text);
}
.breadcrumbs{
    margin:6px 0 18px;
    color:var(--muted);
    font-size:16px;
}
/* SPECIFICALLY TARGETS LINKS IN BREADCRUMBS TO USE MUTED COLOR AND REMOVE HOVER UNDERLINE */
.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
}
.breadcrumbs a:hover {
    text-decoration: none; /* Prevent underline on hover for breadcrumbs */
    color: var(--accent);
}

.footer{
    margin-top:60px;
    color:var(--muted);
    font-size:12px;
    opacity:.9;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

/* --- Iframe Specific Styling and Loading Spinner --- */
.iframe-wrap {
    position: relative;
    width: 100%;
    height: 750px; /* Controls the visible height of the spreadsheet */
    overflow-y: hidden; /* Prevents container from having a scrollbar */
    margin-bottom: 24px;
    
    /* Loading Spinner Control */
    display: flex; 
    justify-content: center;
    align-items: center;
    background-color: #f8f8f8; /* Light gray background while loading */
    transition: background-color 0.3s;
}

/* Spinner element */
.spinner {
    border: 6px solid #f3f3f3; /* Light grey */
    border-top: 6px solid var(--accent); /* Red/Accent color */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite; /* Animation name, duration, timing, loop */
    z-index: 10; /* Ensure spinner is on top */
}

/* Spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Initial state (loading) */
.iframe-loading .spinner {
    display: block; /* Show spinner */
}
.iframe-loading iframe {
    opacity: 0; /* Hide iframe */
}

/* Loaded state */
.iframe-loaded .spinner {
    display: none;
}
.iframe-loaded iframe {
    opacity: 1; /* Show iframe */
    transition: opacity 0.5s ease-in-out;
}

/* Iframe dimensions */
.iframe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%; 
    border: 0;
}

/* --- Iframe Specific Styling and Loading Spinner --- */
/* ... (Existing iframe-wrap styles here) ... */

/* Initial state: Default message is shown */
.iframe-wrap .default-message {
    /* Styles for the select category box (must be here or in your <style> block) */
    text-align: center;
    padding: 100px 20px;
    font-size: 1.2em;
    color: var(--muted);
    background-color: var(--card);
    border: 1px dashed #ccc;
    border-radius: 8px;
    margin-top: 20px;
}
/* Hides the default message once a tab has been clicked */
.iframe-active .default-message {
    display: none;
}

/* Initial state (NOT loading, NOT active) */
.iframe-wrap .spinner,
.iframe-wrap iframe {
    display: none; /* Spinner and iframe are hidden by default */
}


/* Loading state (Triggered by button click in JS) */
.iframe-loading .default-message {
    display: none; /* Hide message */
}
.iframe-loading .spinner {
    display: block; /* Show spinner */
}
.iframe-loading iframe {
    opacity: 0; /* Keep iframe content hidden while loading */
    display: block; /* Make iframe reserve its space */
}

/* Loaded state (Triggered by iframe.onload in JS) */
.iframe-loaded .spinner {
    display: none;
}
.iframe-loaded iframe {
    opacity: 1; /* Show iframe content */
    display: block;
    transition: opacity 0.5s ease-in-out;
}

/* --- Vehicle Tab Menu Styling --- */
.tab-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd; /* Optional separator line */
}

.tab-button {
    background: var(--card);
    color: var(--text);
    padding: 8px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    /* Reset button styles */
    font-family: inherit; 
    text-align: center;
}

.tab-button:hover:not(.active) {
    background: #f0f0f0;
    border-color: var(--accent);
}

.tab-button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
