/*
Theme Name:   DDFS Shop
Theme URI:    https://example.com/ddfs-shop
Description:  A modern, high-performance WooCommerce theme designed for ecommerce excellence. Features responsive design, WooCommerce deep integration, and optimized for conversions.
Author:       DDFS Team
Author URI:   https://example.com
Version:      1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  ddfs-shop
Tags:         e-commerce, woocommerce, shop, responsive, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready
*/

/* ==========================================================================
   Table of Contents
   ========================================================================== */
/*
   1. CSS Reset & Normalization
   2. Base Typography
   3. Layout & Grid
   4. Header
   5. Navigation
   6. Content
   7. WooCommerce Overrides
   8. Footer
   9. Responsive Design
   10. Utilities
*/

/* ==========================================================================
   1. CSS Reset & Normalization
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    background-color: #fff;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

/* ==========================================================================
   2. Base Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1.5rem;
}

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #004499;
}

/* ==========================================================================
   3. Layout & Grid
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    max-width: 100%;
    padding: 0 20px;
}

.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-content {
    flex: 1;
    padding: 40px 0;
}

/* ==========================================================================
   4. Header
   ========================================================================== */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {
    display: flex;
    align-items: center;
}

.site-logo img {
    max-height: 60px;
    width: auto;
}

.site-title {
    font-size: 1.75rem;
    margin: 0;
    font-weight: 700;
}

.site-title a {
    color: #1a1a1a;
}

.site-description {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
}

/* ==========================================================================
   5. Navigation
   ========================================================================== */
.main-navigation {
    display: flex;
    align-items: center;
    gap: 30px;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    color: #333;
    font-weight: 500;
    padding: 8px 12px;
    display: block;
    transition: color 0.3s ease;
}

.main-navigation a:hover {
    color: #0066cc;
}

/* Submenu Styles - Hide by default */
.main-navigation ul.sub-menu,
.main-navigation .sub-menu,
#primary-menu .sub-menu {
    position: absolute !important;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 10px 0;
    margin: 0;
    display: none !important;
    flex-direction: column;
    gap: 0;
    z-index: 1000;
    list-style: none;
}

/* Show submenu on hover */
.main-navigation .menu-item-has-children:hover > .sub-menu,
.main-navigation li:hover > ul.sub-menu,
#primary-menu .menu-item-has-children:hover > .sub-menu {
    display: flex !important;
}

.main-navigation .sub-menu li {
    width: 100%;
    display: block;
}

.main-navigation .sub-menu a {
    padding: 10px 20px;
    white-space: nowrap;
}

.main-navigation .sub-menu a:hover {
    background-color: #f5f5f5;
}

/* Nested Submenus */
.main-navigation .sub-menu .sub-menu,
#primary-menu .sub-menu .sub-menu {
    left: 100%;
    top: 0;
}

.main-navigation .sub-menu .menu-item-has-children:hover > .sub-menu {
    display: flex !important;
}

/* Arrow indicators for menu items with children */
.main-navigation .menu-item-has-children > a::after {
    content: "▾";
    margin-left: 5px;
    font-size: 0.8em;
}

.main-navigation .sub-menu .menu-item-has-children > a::after {
    content: "▸";
    float: right;
    margin-left: 10px;
}

/* Submenu toggle button (for mobile) */
.submenu-toggle {
    display: none;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

/* Header Cart */
.header-cart {
    position: relative;
}

.header-cart a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    font-weight: 500;
}

.cart-count {
    background-color: #0066cc;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Header Search */
.header-search {
    margin-left: auto;
}

.header-search.search-menu-right {
    display: flex;
    align-items: center;
}

.header-search form {
    display: flex;
    align-items: center;
    margin: 0;
}

.header-search input[type="search"] {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    width: 200px;
    transition: border-color 0.3s ease;
}

.header-search input[type="search"]:focus {
    outline: none;
    border-color: #0066cc;
}

.header-search button[type="submit"],
.header-search input[type="submit"] {
    padding: 8px 16px;
    background: #0066cc;
    color: #fff;
    border: 1px solid #0066cc;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.header-search button[type="submit"]:hover,
.header-search input[type="submit"]:hover {
    background: #0052a3;
}

/* Search Below Menu */
.header-search-below {
    padding: 15px 0;
    border-top: 1px solid #e5e5e5;
}

.header-search-below form {
    display: flex;
    margin: 0;
}

.header-search-below.search-below-left {
    text-align: left;
}

.header-search-below.search-below-left form {
    justify-content: flex-start;
}

.header-search-below.search-below-center {
    text-align: center;
}

.header-search-below.search-below-center form {
    justify-content: center;
}

.header-search-below.search-below-right {
    text-align: right;
}

.header-search-below.search-below-right form {
    justify-content: flex-end;
}

.header-search-below input[type="search"] {
    padding: 10px 15px;
    border: 1px solid #e5e5e5;
    border-radius: 4px 0 0 4px;
    font-size: 15px;
    width: 100%;
    max-width: 400px;
}

.header-search-below input[type="search"]:focus {
    outline: none;
    border-color: #0066cc;
}

.header-search-below button[type="submit"],
.header-search-below input[type="submit"] {
    padding: 10px 20px;
    background: #0066cc;
    color: #fff;
    border: 1px solid #0066cc;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 15px;
    white-space: nowrap;
}

.header-search-below button[type="submit"]:hover,
.header-search-below input[type="submit"]:hover {
    background: #0052a3;
}

/* ==========================================================================
   6. Content
   ========================================================================== */
.content-area {
    max-width: 1200px;
    margin: 0 auto;
}

.site-main {
    padding: 40px 20px;
}

article {
    margin-bottom: 40px;
}

.entry-header {
    margin-bottom: 30px;
}

.entry-title {
    margin-bottom: 10px;
}

.entry-meta {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.entry-content {
    line-height: 1.8;
}

/* ==========================================================================
   7. WooCommerce Overrides
   ========================================================================== */
.woocommerce-breadcrumb {
    margin-bottom: 30px;
    margin-top: 20px;
    font-size: 0.875rem;
    color: #666;
    padding: 15px 0;
    border-bottom: 1px solid #e5e5e5;
}

.woocommerce-breadcrumb a {
    color: #0073aa;
    text-decoration: none;
}

.woocommerce-breadcrumb a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Product Grid */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

body.woocommerce.columns-2 ul.products,
.woocommerce.columns-2 ul.products {
    grid-template-columns: repeat(2, 1fr);
}

body.woocommerce.columns-3 ul.products,
.woocommerce.columns-3 ul.products {
    grid-template-columns: repeat(3, 1fr);
}

body.woocommerce.columns-4 ul.products,
.woocommerce.columns-4 ul.products {
    grid-template-columns: repeat(4, 1fr);
}

body.woocommerce.columns-5 ul.products,
.woocommerce.columns-5 ul.products {
    grid-template-columns: repeat(5, 1fr);
}

body.woocommerce.columns-6 ul.products,
.woocommerce.columns-6 ul.products {
    grid-template-columns: repeat(6, 1fr);
}

.woocommerce ul.products li.product {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.woocommerce ul.products li.product img {
    width: 100%;
    height: auto;
    display: block;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 1.1rem;
    padding: 15px 15px 10px;
    margin: 0;
}

.woocommerce ul.products li.product .price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0066cc;
    padding: 0 15px 15px;
    display: block;
}

/* Add to Cart Button */
.woocommerce ul.products li.product .button {
    width: 100%;
    padding: 12px;
    background-color: #0066cc;
    color: #fff;
    border: none;
    border-radius: 0;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.woocommerce ul.products li.product .button:hover {
    background-color: #004499;
}

/* Single Product Page */
.woocommerce div.product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.woocommerce div.product .woocommerce-product-gallery {
    grid-column: 1;
    position: relative !important;
}

.woocommerce div.product .woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
    position: relative !important;
}

/* Product Gallery Lightbox/Fullscreen Trigger Button */
.woocommerce div.product .woocommerce-product-gallery__trigger {
    position: absolute !important;
    top: auto !important;
    right: 15px !important;
    bottom: 110px !important;
    left: auto !important;
    z-index: 99 !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.woocommerce div.product .woocommerce-product-gallery__trigger:hover {
    background: rgba(0, 102, 204, 0.9) !important;
    transform: scale(1.1) !important;
}

.woocommerce div.product .woocommerce-product-gallery__trigger::before {
    content: "⛶" !important;
    font-size: 24px !important;
    color: #fff !important;
    line-height: 1 !important;
}

.woocommerce div.product .woocommerce-product-gallery__trigger img {
    display: none !important;
}

/* Product Gallery Thumbnails - Horizontal Layout */
.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    margin-top: 15px !important;
    padding: 0 !important;
    list-style: none !important;
    overflow-x: auto !important;
}

.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs li {
    flex: 0 0 auto !important;
    width: 80px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs li img {
    width: 100% !important;
    height: 80px !important;
    object-fit: cover !important;
    border: 2px solid #e5e5e5 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    opacity: 0.6 !important;
}

.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs li img:hover {
    border-color: #0066cc !important;
    opacity: 1 !important;
    transform: scale(1.05) !important;
}

.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
    border-color: #0066cc !important;
    opacity: 1 !important;
}

.woocommerce div.product .summary {
    grid-column: 2;
}

.woocommerce div.product .product_title {
    font-size: 2rem;
    margin-bottom: 15px;
}

.woocommerce div.product p.price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0066cc;
    margin-bottom: 20px;
}

.woocommerce div.product .woocommerce-product-details__short-description {
    margin-bottom: 25px;
    line-height: 1.8;
}

.woocommerce div.product form.cart {
    margin-bottom: 25px;
}

.woocommerce div.product form.cart .button {
    background-color: #0066cc;
    color: #fff;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.woocommerce div.product form.cart .button:hover {
    background-color: #004499;
}

/* Cart Page */
.woocommerce table.cart {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.woocommerce table.cart th,
.woocommerce table.cart td {
    padding: 15px;
    border: 1px solid #e5e5e5;
}

.woocommerce table.cart th {
    background-color: #f8f8f8;
    font-weight: 600;
}

/* Checkout */
.woocommerce-checkout .woocommerce {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.woocommerce form.checkout {
    grid-column: 1;
}

.woocommerce-checkout #order_review_heading,
.woocommerce-checkout #order_review {
    grid-column: 2;
}

/* ==========================================================================
   8. Footer
   ========================================================================== */
.site-footer {
    background-color: #1a1a1a;
    color: #fff;
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-widget h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-widget ul {
    list-style: none;
}

.footer-widget ul li {
    margin-bottom: 8px;
}

.footer-widget a {
    color: #ccc;
}

.footer-widget a:hover {
    color: #fff;
}

.site-info {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    color: #999;
    font-size: 0.875rem;
}

/* ==========================================================================
   9. Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .main-navigation ul {
        flex-direction: column;
        gap: 10px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-navigation {
        display: none;
    }
    
    .main-navigation.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        padding: 20px;
        z-index: 999;
    }
    
    /* Mobile submenu overrides */
    .main-navigation .sub-menu,
    .main-navigation ul.sub-menu,
    #primary-menu .sub-menu {
        position: static !important;
        box-shadow: none !important;
        padding-left: 20px !important;
        display: none !important;
        margin-top: 5px !important;
        border-radius: 0 !important;
    }
    
    .main-navigation .sub-menu.toggled-on {
        display: flex !important;
    }
    
    .main-navigation .menu-item-has-children:hover > .sub-menu,
    #primary-menu .menu-item-has-children:hover > .sub-menu {
        display: none !important; /* Disable hover on mobile */
    }
    
    .main-navigation .sub-menu.toggled-on,
    #primary-menu .sub-menu.toggled-on {
        display: flex !important; /* Use toggle instead */
    }
    
    .submenu-toggle {
        display: inline-block;
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        font-size: 1.2em;
        color: #333;
        vertical-align: middle;
    }
    
    .submenu-toggle[aria-expanded="true"]::before {
        content: "▴";
    }
    
    .submenu-toggle[aria-expanded="false"]::before {
        content: "▾";
    }
    
    /* Hide arrow indicators in mobile */
    .main-navigation .menu-item-has-children > a::after,
    .main-navigation .sub-menu .menu-item-has-children > a::after {
        display: none;
    }
    
    .woocommerce ul.products {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .woocommerce div.product {
        grid-template-columns: 1fr;
    }
    
    .woocommerce-checkout .woocommerce {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .woocommerce ul.products {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   10. Utilities
   ========================================================================== */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

.alignleft {
    float: left;
    margin-right: 20px;
}

.alignright {
    float: right;
    margin-left: 20px;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   Shop Categories Grid
   ========================================================================== */
.ddfs-shop-categories-section {
    margin-bottom: 40px;
    padding: 20px 0;
}

.ddfs-categories-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.ddfs-shop-categories-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.ddfs-shop-categories-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.ddfs-shop-categories-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.ddfs-shop-categories-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.ddfs-shop-categories-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

.ddfs-category-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ddfs-category-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
    border-color: #ccc;
}

.ddfs-category-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ddfs-category-image {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.ddfs-category-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ddfs-category-item:hover .ddfs-category-image img {
    transform: scale(1.05);
}

.ddfs-category-content {
    padding: 15px;
    text-align: center;
}

.ddfs-category-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.ddfs-category-count {
    font-size: 14px;
    color: #666;
    display: block;
}

/* Responsive Design for Categories */
@media screen and (max-width: 992px) {
    .ddfs-shop-categories-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ddfs-shop-categories-grid.columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .ddfs-categories-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .ddfs-shop-categories-grid.columns-6,
    .ddfs-shop-categories-grid.columns-4,
    .ddfs-shop-categories-grid.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ddfs-shop-categories-grid {
        gap: 15px;
    }
    
    .ddfs-category-content {
        padding: 12px;
    }
    
    .ddfs-category-name {
        font-size: 16px;
    }
}

@media screen and (max-width: 480px) {
    .ddfs-shop-categories-section {
        margin-bottom: 30px;
    }
    
    .ddfs-categories-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .ddfs-shop-categories-grid {
        gap: 10px;
    }
    
    .ddfs-category-content {
        padding: 10px;
    }
    
    .ddfs-category-name {
        font-size: 14px;
    }
    
    .ddfs-category-count {
        font-size: 12px;
    }
}
