/**
 * Hero Module - Frontend Styles
 * 
 * Styling för hero-sektioner (single och slider) med tema-stöd
 *
 * @package SQO_Modular_Plugin
 * @subpackage Modules/Hero
 */

/* ==========================================================================
   Base Hero Styles (Single & Slider)
   ========================================================================== */

.sqo-hero-section {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    background: #000;
}

/* Hero Media Container */
.sqo-hero-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

/* Hero Image - object-position sätts via inline style i PHP (från "Bildfokus" dropdown)
   object-fit: cover finns i WordPress Override-sektionen längst ned med !important */
.sqo-hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hero Video */
.sqo-hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Media Link Wrapper (när bild/video är klickbar) */
.sqo-hero-media-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* Content Overlay */
.sqo-hero-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 40px 20px;
    pointer-events: none;
}

.sqo-hero-content-inner {
    max-width: 80%;
    text-align: center;
    pointer-events: auto;
}

/* ==========================================================================
   Logotyp i övre vänstra hörnet
   ========================================================================== */

.sqo-hero-logo {
    position: absolute;
    top: 60px;
    left: 60px;
    z-index: 10;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    text-decoration: none;
    display: block;
    pointer-events: auto;
}

.sqo-hero-logo:hover {
    opacity: 0.9;
}

/* ==========================================================================
   Tema Styling (Light & Dark)
   ========================================================================== */

/* Light Theme - Default (vita texter, vit knapp) */
.sqo-hero-theme-light .sqo-hero-content-inner {
    color: #fff;
}

.sqo-hero-theme-light .sqo-hero-subtitle {
    color: #fff;
}

.sqo-hero-theme-light .sqo-hero-title {
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sqo-hero-theme-light .sqo-hero-text {
    color: #fff;
    opacity: 0.95;
}

.sqo-hero-theme-light .sqo-hero-button {
    background: #fff;
    color: #000;
}

.sqo-hero-theme-light .sqo-hero-button:hover {
    background: #f0f0f0;
}

/* Dark Theme (svarta texter, svart knapp) */
.sqo-hero-theme-dark .sqo-hero-content-inner {
    color: #1a1a1a;
}

.sqo-hero-theme-dark .sqo-hero-subtitle {
    color: #333;
    opacity: 0.9;
}

.sqo-hero-theme-dark .sqo-hero-title {
    color: #1a1a1a;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.sqo-hero-theme-dark .sqo-hero-text {
    color: #333;
    opacity: 0.95;
}

.sqo-hero-theme-dark .sqo-hero-button {
    background: #1a1a1a;
    color: #fff;
}

.sqo-hero-theme-dark .sqo-hero-button:hover {
    background: #000;
}

/* ==========================================================================
   Content Styling
   ========================================================================== */

.sqo-hero-subtitle {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 12px;
    letter-spacing: 2px;
}

.sqo-hero-title {
    display: block; /* Krävs eftersom elementet är <span> (inte h1) för SEO */
    font-size: 6vw;
    font-weight: 900;
    line-height: 1.0;
    margin: 0 0;
}

.sqo-hero-text {
    font-size: 20px;
    line-height: 1.6;
    margin: 0 0 32px;
}

.sqo-hero-button {
    display: inline-block;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sqo-hero-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   CSS Animations för Stillbilder
   ========================================================================== */

/* Animation endast på .sqo-hero-animated container */
.sqo-hero-animated {
    overflow: hidden;
}

.sqo-hero-animated .sqo-hero-image {
    transform-origin: center center;
    will-change: transform;
}

/* Zoom In (Ken Burns style) */
@keyframes sqoHeroZoomIn {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.15);
    }
}

/* Zoom Out */
@keyframes sqoHeroZoomOut {
    0% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* Pan Left */
@keyframes sqoHeroPanLeft {
    0% {
        transform: translateX(0) scale(1.1);
    }
    100% {
        transform: translateX(-8%) scale(1.1);
    }
}

/* Pan Right */
@keyframes sqoHeroPanRight {
    0% {
        transform: translateX(0) scale(1.1);
    }
    100% {
        transform: translateX(8%) scale(1.1);
    }
}

/* Ken Burns (Zoom + Pan kombinerat) */
@keyframes sqoHeroKenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.2) translate(-5%, -3%);
    }
}

/* ==========================================================================
   Slider Styles (Swiper overrides)
   ========================================================================== */

.sqo-hero-slider-wrapper {
    height: 600px;
    background: #000;
}

.sqo-hero-swiper {
    width: 100%;
    height: 100%;
}

/* KRITISKT: Swiper sätter height: auto som default på slides
   Vi måste tvinga height: 100% för att bilden ska fylla hela hero-ytan */
.sqo-hero-swiper .swiper-slide {
    position: relative;
    overflow: hidden;
    background: #000;
    height: 100% !important;
}

/* Säkerställ att media-container fyller hela sliden */
.sqo-hero-swiper .sqo-hero-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Navigation Arrows */
.sqo-hero-button-prev,
.sqo-hero-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sqo-hero-button-prev:hover,
.sqo-hero-button-next:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.sqo-hero-button-prev {
    left: 24px;
}

.sqo-hero-button-next {
    right: 24px;
}

.sqo-hero-button-prev svg,
.sqo-hero-button-next svg {
    width: 24px;
    height: 24px;
}

/* Disabled state */
.sqo-hero-button-prev.swiper-button-disabled,
.sqo-hero-button-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Pagination Dots */
.sqo-hero-pagination {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sqo-hero-pagination .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 1;
}

.sqo-hero-pagination .swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.sqo-hero-pagination .swiper-pagination-bullet-active {
    background: #fff;
    width: 32px;
    border-radius: 6px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .sqo-hero-section,
    .sqo-hero-slider-wrapper {
        height: 500px;
    }
    
    .sqo-hero-title {
        font-size: 8vw;
    }
    
    .sqo-hero-subtitle {
        font-size: 16px;
    }
    
    .sqo-hero-text {
        font-size: 18px;
    }
    
    .sqo-hero-button {
        padding: 14px 32px;
        font-size: 15px;
    }
    
    /* Logotyp */
    .sqo-hero-logo {
        font-size: 20px;
        top: 20px;
        left: 20px;
    }
    
    /* Mindre navigation */
    .sqo-hero-button-prev,
    .sqo-hero-button-next {
        width: 48px;
        height: 48px;
    }
    
    .sqo-hero-button-prev {
        left: 16px;
    }
    
    .sqo-hero-button-next {
        right: 16px;
    }
}

/* Mobile (max 767px) */
@media (max-width: 767px) {
    .sqo-hero-section,
    .sqo-hero-slider-wrapper {
        height: 400px;
    }
    
    .sqo-hero-content {
        padding: 20px 16px;
    }
    
    .sqo-hero-subtitle {
        font-size: 14px;
        letter-spacing: 1px;
        margin-bottom: 8px;
    }
    
    .sqo-hero-title {
        font-size: 8vw;
        margin-bottom: 12px;
    }
    
    .sqo-hero-text {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .sqo-hero-button {
        padding: 12px 28px;
        font-size: 14px;
    }
    
    /* Logotyp */
    .sqo-hero-logo {
        font-size: 18px;
        top: 16px;
        left: 16px;
    }
    
    /* Kompaktare navigation på mobil */
    .sqo-hero-button-prev,
    .sqo-hero-button-next {
        width: 40px;
        height: 40px;
    }
    
    .sqo-hero-button-prev svg,
    .sqo-hero-button-next svg {
        width: 20px;
        height: 20px;
    }
    
    .sqo-hero-button-prev {
        left: 12px;
    }
    
    .sqo-hero-button-next {
        right: 12px;
    }
    
    /* Mindre pagination dots */
    .sqo-hero-pagination {
        bottom: 16px;
        gap: 8px;
    }
    
    .sqo-hero-pagination .swiper-pagination-bullet {
        width: 10px;
        height: 10px;
    }
    
    .sqo-hero-pagination .swiper-pagination-bullet-active {
        width: 24px;
    }
}

/* Small Mobile (max 480px) */
@media (max-width: 480px) {
    .sqo-hero-section,
    .sqo-hero-slider-wrapper {
        height: 350px;
    }
    
    .sqo-hero-title {
        font-size: 8vw;
    }
    
    .sqo-hero-text {
        font-size: 14px;
        margin-bottom: 16px;
    }
    
    .sqo-hero-button {
        padding: 10px 24px;
        font-size: 13px;
    }
    
    /* Logotyp */
    .sqo-hero-logo {
        font-size: 16px;
        top: 12px;
        left: 12px;
    }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU-accelerering för animationer */
.sqo-hero-animated .sqo-hero-image,
.sqo-hero-button,
.sqo-hero-button-prev,
.sqo-hero-button-next,
.sqo-hero-logo {
    will-change: transform;
}

/* Förhindra layout shift */
.sqo-hero-section,
.sqo-hero-slider-wrapper {
    contain: layout style paint;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus states för keyboard navigation */
.sqo-hero-button:focus,
.sqo-hero-button-prev:focus,
.sqo-hero-button-next:focus,
.sqo-hero-pagination .swiper-pagination-bullet:focus,
.sqo-hero-logo:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 4px;
}

/* Reduce motion för användare som föredrar det */
@media (prefers-reduced-motion: reduce) {
    .sqo-hero-animated .sqo-hero-image {
        animation: none !important;
    }
    
    .sqo-hero-button,
    .sqo-hero-button-prev,
    .sqo-hero-button-next,
    .sqo-hero-logo {
        transition: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .sqo-hero-section,
    .sqo-hero-slider-wrapper {
        height: auto;
        page-break-inside: avoid;
    }
    
    .sqo-hero-button-prev,
    .sqo-hero-button-next,
    .sqo-hero-pagination {
        display: none;
    }
    
    .sqo-hero-content {
        position: static;
        background: none !important;
    }
    
    .sqo-hero-theme-light .sqo-hero-content-inner {
        color: #000;
    }
    
    .sqo-hero-theme-dark .sqo-hero-content-inner {
        color: #000;
    }
    
    .sqo-hero-logo {
        color: #000;
    }
}

/* ==========================================================================
   WordPress & Elementor Override - Överrid tema/plugins som sätter height: auto
   ========================================================================== */

/* Override WordPress inline width/height HTML attributes
   KRITISKT: object-fit: cover krävs för att:
   1. Bilden ska täcka hela hero-ytan (även på mobil)
   2. object-position (Bildfokus) ska fungera - det ignoreras utan object-fit
   object-position sätts via inline style i PHP från "Bildfokus" dropdown */
.sqo-hero-image,
.sqo-hero-video {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
}

/* ELEMENTOR OVERRIDE: .elementor img { height: auto } måste överridas
   Använder hög specificity för att vinna över Elementors globala regel */
.elementor .sqo-hero-section .sqo-hero-image,
.elementor .sqo-hero-slider-wrapper .sqo-hero-image,
.elementor .sqo-hero-media .sqo-hero-image,
.elementor .sqo-hero-media img {
    height: 100% !important;
    width: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
}