/**
 * Short Circuit - Shared Responsive & Iframe-Friendly Styles
 * Optimized for all screen sizes including embedded iframes
 */

/* ============================================
   BASE RESPONSIVE & IFRAME SETTINGS
   ============================================ */

/* Ensure proper sizing in all contexts including iframes */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Iframe-specific overrides */
html.in-iframe,
html.in-iframe body {
    /* Ensure content fills iframe properly */
    min-height: 100%;
}

/* Box sizing reset */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Container fluid behavior */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ============================================
   TYPOGRAPHY SCALING
   ============================================ */

/* Base font sizes with responsive scaling */
html {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
}

/* ============================================
   NAVIGATION RESPONSIVE
   ============================================ */

/* Mobile hamburger menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--white, #ffffff);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu,
    .nav-links {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background: var(--navy, #1a2332);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.1);
        padding: 20px 0;
        gap: 15px;
        z-index: 1000;
    }

    .nav-menu.active,
    .nav-links.active {
        left: 0;
    }

    .nav-actions {
        display: none;
    }
}

/* Logo responsive sizing */
.logo {
    font-size: clamp(16px, 4vw, 24px);
}

/* ============================================
   BUTTON RESPONSIVE
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .btn-large {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

/* ============================================
   GRID SYSTEM RESPONSIVE
   ============================================ */

/* Generic responsive grid */
.responsive-grid {
    display: grid;
    gap: 30px;
}

.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);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .responsive-grid {
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .responsive-grid {
        gap: 15px;
    }
}

/* ============================================
   SECTION PADDING RESPONSIVE
   ============================================ */

.section {
    padding: 80px 0;
}

@media (max-width: 1024px) {
    .section {
        padding: 60px 0;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 30px 0;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 360px) {
    .section {
        padding: 25px 0;
    }
    
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ============================================
   HERO SECTION RESPONSIVE
   ============================================ */

.hero {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    align-items: center;
    padding: 100px 0 60px;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-text h1 {
    font-size: clamp(1.75rem, 5vw, 3rem);
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero-text p {
    font-size: clamp(0.9rem, 2vw, 1.25rem);
    line-height: 1.6;
    margin-bottom: 30px;
}

.hero-ctas {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 1024px) {
    .hero-content {
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .hero {
        min-height: auto;
        padding: 80px 0 40px;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }

    .hero-ctas {
        justify-content: center;
    }

    .trust-badges {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 70px 0 30px;
    }

    .hero-ctas {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .hero-ctas .btn {
        width: 100%;
        max-width: 280px;
    }

    .trust-badges {
        flex-direction: column;
        gap: 8px;
    }
}

/* ============================================
   SECTION HEADERS RESPONSIVE
   ============================================ */

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: 15px;
}

.section-header p {
    font-size: clamp(0.9rem, 2vw, 1.125rem);
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .section-header {
        margin-bottom: 40px;
    }
}

@media (max-width: 480px) {
    .section-header {
        margin-bottom: 30px;
    }
}

/* ============================================
   CARDS RESPONSIVE
   ============================================ */

.card,
.project-card,
.product-card,
.how-card,
.testimonial-card {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 480px) {
    .card,
    .project-card,
    .product-card,
    .how-card,
    .testimonial-card {
        border-radius: 10px;
    }
}

/* ============================================
   PRODUCT GRID RESPONSIVE
   ============================================ */

.shop-grid,
.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

@media (max-width: 1024px) {
    .shop-grid,
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .shop-grid,
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .shop-grid,
    .project-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Product Card responsive tweaks */
.product-info {
    padding: 20px;
}

@media (max-width: 768px) {
    .product-info {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .product-info {
        padding: 15px;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .skill-tag {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
}

/* ============================================
   CART LAYOUT RESPONSIVE
   ============================================ */

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
}

@media (max-width: 1024px) {
    .cart-layout {
        grid-template-columns: 1fr 320px;
        gap: 25px;
    }
}

@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cart-summary {
        position: relative;
        top: 0;
    }
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 20px;
    align-items: center;
}

@media (max-width: 600px) {
    .cart-item {
        grid-template-columns: 80px 1fr;
        gap: 15px;
    }

    .cart-item-actions {
        grid-column: span 2;
        flex-direction: row;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 400px) {
    .cart-item {
        grid-template-columns: 70px 1fr;
        gap: 12px;
    }

    .cart-item-image {
        width: 70px;
        height: 70px;
    }
}

/* ============================================
   FOOTER RESPONSIVE
   ============================================ */

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 600px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

footer {
    padding: 60px 0 20px;
}

@media (max-width: 768px) {
    footer {
        padding: 40px 0 20px;
    }
}

/* ============================================
   MODAL & OVERLAY RESPONSIVE
   ============================================ */

.popup-overlay,
.notify-overlay,
.side-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
}

.popup-content,
.notify-popup {
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 480px) {
    .popup-content,
    .notify-popup {
        width: 95%;
        padding: 25px 20px;
        margin: 10px;
    }

    .popup-content h2,
    .notify-popup h3 {
        font-size: 1.25rem;
    }
}

/* Side Cart responsive */
.side-cart {
    width: 400px;
    max-width: 90vw;
}

@media (max-width: 480px) {
    .side-cart {
        width: 100%;
        max-width: 100vw;
    }

    .side-cart-header {
        padding: 15px 20px;
    }

    .side-cart-content {
        padding: 15px;
    }

    .side-cart-footer {
        padding: 15px;
    }
}

/* ============================================
   FORM ELEMENTS RESPONSIVE
   ============================================ */

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="password"],
textarea,
select {
    font-size: 16px; /* Prevents zoom on iOS */
    width: 100%;
    padding: 12px;
    border-radius: 8px;
}

@media (max-width: 480px) {
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        padding: 10px;
    }
}

.email-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .email-form {
        flex-direction: column;
    }

    .email-form input,
    .email-form button {
        width: 100%;
    }
}

/* ============================================
   PRODUCT PAGE RESPONSIVE
   ============================================ */

.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: start;
}

@media (max-width: 992px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .product-gallery {
        position: relative;
        top: 0;
    }
}

.main-image {
    height: 400px;
}

@media (max-width: 768px) {
    .main-image {
        height: 300px;
    }

    .product-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .main-image {
        height: 250px;
    }

    .product-title {
        font-size: 1.5rem;
    }

    .thumbnail-row {
        gap: 8px;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* ============================================
   CHALLENGE/PRIZE SECTIONS RESPONSIVE
   ============================================ */

.prize-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

@media (max-width: 768px) {
    .prize-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .prize-amount {
        font-size: 1.75rem;
    }
}

/* ============================================
   COUNTDOWN/BANNER RESPONSIVE
   ============================================ */

.challenge-banner,
.interest-banner {
    padding: 15px;
}

.challenge-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 768px) {
    .challenge-content {
        flex-direction: column;
        text-align: center;
    }

    .countdown {
        justify-content: center;
    }
}

.interest-banner {
    max-width: 520px;
    width: 90%;
}

@media (max-width: 550px) {
    .interest-banner {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .interest-banner-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   FILTER BAR RESPONSIVE
   ============================================ */

.filter-bar {
    position: sticky;
    top: 60px;
    z-index: 100;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 5px 0;
}

@media (max-width: 768px) {
    .filter-bar {
        top: 55px;
    }

    .filter-list {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .filter-btn {
        flex-shrink: 0;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .filter-btn {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* ============================================
   IMAGE CAROUSEL RESPONSIVE
   ============================================ */

.product-carousel,
.product-image {
    height: 220px;
}

@media (max-width: 768px) {
    .product-carousel,
    .product-image {
        height: 180px;
    }

    .carousel-btn {
        opacity: 1;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .product-carousel,
    .product-image {
        height: 220px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide on specific breakpoints */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .hide-small {
        display: none !important;
    }
}

/* Text alignment responsive */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center;
    }
}

/* Flex utilities */
.flex-wrap-mobile {
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .flex-column-mobile {
        flex-direction: column;
    }
}

/* ============================================
   IFRAME DETECTION & SPECIAL HANDLING
   ============================================ */

/* Detect if in iframe via JS and add class */
@media (max-width: 100vw) {
    /* When embedded in narrow iframe */
    .in-iframe .navbar {
        padding: 10px 0;
    }

    .in-iframe .hero {
        min-height: 80vh;
        padding-top: 60px;
    }

    .in-iframe .section {
        padding: 30px 0;
    }

    .in-iframe .footer {
        padding: 30px 0 15px;
    }
}

/* Extra narrow embeds */
@media (max-width: 320px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .hero-text h1 {
        font-size: 1.25rem;
    }

    .section-header h2 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .logo {
        font-size: 14px;
    }

    .navbar {
        padding: 8px 0;
    }

    .cart-count {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .navbar,
    .footer,
    .back-to-top,
    .interest-banner,
    .page-loader,
    .side-cart,
    .side-cart-overlay,
    .popup-overlay {
        display: none !important;
    }

    .section {
        page-break-inside: avoid;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* ============================================
   REDUCED MOTION PREFERENCE
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Touch-friendly tap targets */
    .btn,
    .nav-menu a,
    .filter-btn,
    .carousel-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch */
    .project-card:hover,
    .product-card:hover,
    .how-card:hover {
        transform: none;
    }

    /* Show carousel buttons always on touch */
    .carousel-btn {
        opacity: 1;
    }
}

/* ============================================
   DISCOUNT & PROMO CODE DISPLAY
   ============================================ */

/* Discount badge for product cards */
.discount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a2332;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.discount-badge.prominent {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #ffffff;
    padding: 6px 12px;
    font-size: 12px;
}

/* Price display with discount */
.price-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-display .original-price {
    color: #6c757d;
    text-decoration: line-through;
    font-size: 14px;
    font-weight: 400;
}

.price-display .sale-price {
    color: #ff6b6b;
    font-size: 22px;
    font-weight: 700;
}

.price-display .promo-note {
    font-size: 12px;
    color: #00cc6a;
    font-weight: 600;
}

/* Inline price with strikethrough */
.price-with-discount {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.price-with-discount .original {
    color: #6c757d;
    text-decoration: line-through;
    font-size: 14px;
}

.price-with-discount .discounted {
    color: #ff6b6b;
    font-size: 20px;
    font-weight: 700;
}

/* Promo code highlight box */
.promo-highlight {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 191, 255, 0.1));
    border: 2px dashed #00cc6a;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    text-align: center;
}

.promo-highlight .code {
    font-family: 'Montserrat', monospace;
    font-weight: 700;
    font-size: 16px;
    color: #00cc6a;
    background: rgba(0, 255, 136, 0.15);
    padding: 4px 12px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.promo-highlight .savings {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #1a2332;
}

/* Product card price section */
.product-price-section {
    margin-top: 8px;
}

.product-price-section .original-price {
    color: #6c757d;
    text-decoration: line-through;
    font-size: 13px;
    display: block;
}

.product-price-section .current-price {
    color: #ff6b6b;
    font-size: 20px;
    font-weight: 700;
}

@media (max-width: 480px) {
    .discount-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .price-display .sale-price {
        font-size: 18px;
    }

    .price-with-discount .discounted {
        font-size: 18px;
    }

    .promo-highlight {
        padding: 10px 12px;
    }

    .promo-highlight .code {
        font-size: 14px;
    }
}
