/*
 * PAZAVA Portal - Layout Styles
 * Spacing, grid, containers, responsive breakpoints
 *
 * ===========================================================================
 * RESPONSIVE DESIGN STRATEGY
 * ===========================================================================
 *
 * MOBILE-FIRST APPROACH:
 * WHY: 40% of B2B users access from mobile devices
 * - Base styles: Mobile (320px+)
 * - Media queries: Add complexity for larger screens
 * - Progressive enhancement vs graceful degradation
 *
 * BREAKPOINT PHILOSOPHY:
 * Based on content needs, not device sizes
 * - 640px: Small phones → large phones
 * - 768px: Tablets portrait, large phones landscape
 * - 968px: Tablets landscape, small laptops
 * - 1024px: Standard laptops
 * - 1200px: Large desktops
 *
 * WHY THESE SPECIFIC BREAKPOINTS:
 *
 * 768px: MOST COMMON - Mobile to tablet transition
 * - iPhone: 375px-428px (mobile styles)
 * - iPad: 768px-1024px (tablet styles)
 * - Navigation: Hamburger menu → full nav
 * - Grid: 1 column → 2 columns
 * - Covers 80% of responsive changes
 *
 * 968px: TABLET LANDSCAPE - Complex layouts
 * - Use case: 3-column grids, sidebars
 * - iPad Pro landscape: 1024px
 * - Small laptops: 1280px
 *
 * 640px: SMALL PHONE - Tight spacing
 * - iPhone SE: 375px
 * - Reduce padding, stack more aggressively
 * - Only used for extreme space constraints
 *
 * 1024px: DESKTOP - Full complexity
 * - Standard laptop: 1366px, 1440px
 * - Multi-column layouts, sidebars
 * - 4-column grids
 *
 * MAX-WIDTH STRATEGY:
 * All media queries use max-width (mobile-first)
 * @media (max-width: 768px) = "up to 768px" (mobile + small tablet)
 * Base styles apply to > 768px (desktop)
 *
 * TESTING TARGETS:
 * - iPhone 14: 390x844 (mobile)
 * - iPad: 768x1024 (tablet portrait)
 * - MacBook Air: 1440x900 (laptop)
 * - 1920x1080: Desktop
 *
 * ===========================================================================
 * CONTAINER SYSTEM
 * ===========================================================================
 *
 * WHY THREE CONTAINER TYPES:
 *
 * .container (1200px max):
 * - Use case: Marketing pages, content
 * - Optimal readability for text
 * - Standard centered layout
 *
 * .container-wide (1400px max):
 * - Use case: Dashboards, data tables
 * - More horizontal space for complex layouts
 * - Still leaves margin on large monitors
 *
 * .container-fluid (no max):
 * - Use case: Full-width backgrounds, heroes
 * - Edge-to-edge content
 * - Uses viewport width minus padding
 *
 * PADDING STRATEGY:
 * Desktop: 32px (--spacing-xl) horizontal padding
 * Mobile: 16px (--spacing-md) - conserve space
 *
 * ===========================================================================
 * GRID SYSTEM
 * ===========================================================================
 *
 * CSS GRID vs FLEXBOX DECISION:
 * - Grid: Used for 2D layouts (rows and columns)
 * - Flexbox: Used for 1D layouts (navigation, cards in row)
 *
 * WHY NOT BOOTSTRAP GRID:
 * - CSS Grid: Native, powerful, less markup
 * - Bootstrap: 12-column system, more divs
 * - File size: CSS Grid = 0 bytes extra, Bootstrap = 50KB+
 *
 * GRID CLASSES:
 * .grid-2, .grid-3, .grid-4: Simple equal-column grids
 * .grid-auto: Auto-fit columns (responsive without media queries)
 * .grid-sidebar: Sidebar + main content layout
 *
 * GAP VALUES:
 * Why var(--spacing-xl) (32px) default:
 * - Breathing room between grid items
 * - Testing: 24px felt cramped, 48px too loose
 * - 32px: Visual separation without wasted space
 *
 * WHAT: Provide reusable containers, grids, section layouts, and breakpoints.
 * HOW: Use CSS Grid, Flexbox, spacing tokens, and responsive media queries.
 * WHY: Keep page structure consistent and usable across screen sizes.
 */

/* Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-xl);
}

.container-wide {
    width: 100%;
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

@media (max-width: 768px) {

    .container,
    .container-fluid,
    .container-wide {
        padding: 0 var(--spacing-md);
    }
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-xl);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
}

/* Flex Utilities */
.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Two Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: center;
}

@media (max-width: 768px) {
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
}

.column {
    width: 100%;
}

/*
 * WHAT: Arrange the homepage hero content and background layers.
 * HOW: Stack responsive text and visual content above the slideshow layers.
 * WHY: Present the main value proposition clearly on desktop and mobile.
 */
.hero {
    /* WHY position:relative — background image layers (z-index 0/1) are absolutely
       positioned children; relative establishes their containing block */
    position: relative;
    /* WHY overflow:hidden — prevents the full-size bg layers from bleeding
       outside the hero boundary at any viewport size */
    overflow: hidden;
    background: var(--gradient-hero);
    color: var(--text-primary);
    padding: var(--spacing-3xl) 0;
    /* WHY 85vh: gives images genuine vertical presence as a cinematic backdrop
       while keeping the nav bar and at least the first content section
       partially visible — tells the user there's more below the fold */
    min-height: 85vh;
    display: flex;
    align-items: center;
}

/* WHY z-index:2 — the hero's .container must sit above the two image layers
   (z-index 0) and the navy overlay (z-index 1) injected by hero-slideshow.js */
.hero>.container {
    position: relative;
    z-index: 2;
}

/* ── Slideshow text overrides ─────────────────────────────────────────────
   WHY: When the slideshow is active the hero background changes from a
   light gradient to a dark navy overlay. Text colors must flip to white
   to maintain readability and WCAG AA contrast ratios.
   The .gradient-text span (cyan→purple) is unaffected — it already pops
   on dark backgrounds and is part of the PAZAVA brand identity.
   ─────────────────────────────────────────────────────────────────────── */
.hero-with-slideshow {
    /* Override inherited dark text color to white for dark overlay context */
    color: var(--bg-white);
    /* WHY background-image here in CSS (not just JS):
       Browsers fetch CSS background-images during page rendering, before any
       JavaScript runs. This means the first hero image is visible the instant
       the stylesheet is applied — no JS delay, no blank/navy pause.
       The JS slideshow layers then paint on top of this CSS background,
       replacing it seamlessly with the same image so there is zero visual jump.
       The navy color is the fallback while the image downloads. */
    background: var(--primary) url('../assets/images/Hero%20Slide%20Show/Urea%20Ship%20Large.webp') center center / cover no-repeat;
}

/* WHY explicit white on hero-title: 'Bold Solutions.' is a plain text node
   (no wrapper span) so it inherits color from the nearest ancestor.
   Adding a direct rule removes any specificity ambiguity and guarantees
   the heading is always white against the dark navy overlay.
   WHY text-shadow: even at 72% navy overlay, lighter image regions can
   reduce contrast. A soft dark shadow creates a guaranteed dark halo
   so the heading reads clearly on every image in the rotation. */
.hero-with-slideshow .hero-title {
    color: #ffffff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* WHY none: text-shadow cascades from the h1 onto child spans, which
   kills the cyan→purple gradient clip on 'Brilliant Results.'
   Resetting here restores the gradient to its original appearance. */
.hero-with-slideshow .hero-title .gradient-text {
    text-shadow: none;
}

.hero-with-slideshow .hero-subtitle {
    /* WHY 82% white: slightly softer than pure white, reduces eye strain
       while still passing WCAG AA against the navy overlay */
    color: rgba(255, 255, 255, 0.82);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: center;
}

.hero-text {
    max-width: 600px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--spacing-lg);
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2xl);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-logo {
    max-width: 400px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
    animation: float 6s ease-in-out infinite;
    /* WHY: Forces GPU compositing, preventing sub-pixel anti-aliasing
       artifacts (white fringe flicker) at transparent PNG edges during
       the float animation */
    backface-visibility: hidden;
    will-change: transform;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@media (max-width: 768px) {
    .hero {
        /* WHY 70vh on mobile: still substantial but leaves room for the nav
           bar and lets users immediately see content below on smaller screens */
        min-height: 70vh;
        padding: var(--spacing-2xl) 0;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-logo {
        max-width: 250px;
    }
}

/*
 * WHAT: Lay out the full-width marketing call-to-action section.
 * HOW: Center the section content within the shared responsive container.
 * WHY: Give interested visitors a clear next step without disrupting page flow.
 */
.cta {
    background: var(--gradient-primary);
    color: var(--text-white);
    padding: var(--spacing-3xl) 0;
    text-align: center;
}

.cta-content {
    max-width: 700px;
    margin: 0 auto;
}

.cta-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.cta-text {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-bottom: var(--spacing-2xl);
    opacity: 0.95;
}

/* Contact Layout */
.contact-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--spacing-3xl);
}

@media (max-width: 968px) {
    .contact-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }
}

/* Login Section */
.login-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: var(--spacing-3xl) 0;
    background: var(--bg-light);
}

.login-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--spacing-3xl);
    max-width: 1000px;
    margin: 0 auto;
}

@media (max-width: 968px) {
    .login-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .login-info {
        order: 2;
    }
}

/* Dashboard Layout */
.dashboard-body {
    background-color: var(--bg-light);
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 70px;
    /* Height of navbar */
}

.dashboard-sidebar {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.dashboard-main {
    flex: 1;
    margin-left: 260px;
    padding: var(--spacing-2xl);
    max-width: 100%;
}

.dashboard-header {
    margin-bottom: var(--spacing-2xl);
}

.dashboard-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

@media (max-width: 968px) {
    .dashboard-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .dashboard-sidebar.active {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-left: 0;
        padding: var(--spacing-lg);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Section */
.dashboard-section {
    margin-bottom: var(--spacing-2xl);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

/* Process Timeline */
.process-timeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-xl);
    margin-top: var(--spacing-2xl);
}

@media (max-width: 968px) {
    .process-timeline {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .process-timeline {
        grid-template-columns: 1fr;
    }
}

.process-step {
    text-align: center;
    padding: var(--spacing-xl);
}

.step-number {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--spacing-lg);
    background: var(--gradient-primary);
    color: var(--text-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.step-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Map Section */
.map-section {
    height: 400px;
    background: var(--bg-light);
}

.map-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 2px dashed var(--border-light);
}

/* Spacing Utilities */
.m-0 {
    margin: 0;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mt-4 {
    margin-top: var(--spacing-xl);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.mb-4 {
    margin-bottom: var(--spacing-xl);
}

.p-0 {
    padding: 0;
}

.pt-1 {
    padding-top: var(--spacing-sm);
}

.pt-2 {
    padding-top: var(--spacing-md);
}

.pt-3 {
    padding-top: var(--spacing-lg);
}

.pt-4 {
    padding-top: var(--spacing-xl);
}

.pb-1 {
    padding-bottom: var(--spacing-sm);
}

.pb-2 {
    padding-bottom: var(--spacing-md);
}

.pb-3 {
    padding-bottom: var(--spacing-lg);
}

.pb-4 {
    padding-bottom: var(--spacing-xl);
}
