/* ============================================================
   CrochetByMarie - Main Stylesheet
   A beautiful, feminine crochet-themed e-commerce site
   ============================================================ */

/* ─── CSS Variables (Colors & Fonts) ────────────────────── */
:root {
    --primary: #d4a5a5;        /* Dusty rose */
    --primary-dark: #b88a8a;
    --secondary: #9ec1a3;      /* Sage green */
    --accent: #f4d3c8;         /* Peach */
    --dark: #2c2c2c;
    --gray: #6c6c6c;
    --light-gray: #f5f5f5;
    --white: #ffffff;
    --border: #e0e0e0;
    --success: #5cb85c;
    --error: #d9534f;
    
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    
    --transition: all 0.3s ease;
}

/* ─── Reset & Base Styles ───────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background: var(--white);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

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

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

.section {
    padding: 60px 0;
}

/* ─── Top Bar ────────────────────────────────────────────── */
.top-bar {
    background: var(--dark);
    color: var(--white);
    font-size: 0.875rem;
    padding: 8px 0;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.top-bar i {
    margin-right: 5px;
    color: var(--primary);
}

/* ─── Header ─────────────────────────────────────────────── */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

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

/* Logo */
.logo a {
    display: block;
}

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

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--gray);
    letter-spacing: 1px;
}

/* Main Nav */
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

.main-nav > ul > li {
    position: relative;
}

.main-nav a {
    color: var(--dark);
    font-weight: 500;
    padding: 8px 0;
    display: block;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
}

/* Dropdown */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

.main-nav li:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown li {
    display: block;
}

.dropdown a {
    padding: 10px 20px;
}

.dropdown a:hover {
    background: var(--light-gray);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-btn {
    position: relative;
    font-size: 1.5rem;
    color: var(--dark);
    padding: 5px;
}

.cart-btn:hover {
    color: var(--primary);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--dark);
    transition: var(--transition);
}

.mobile-overlay {
    display: none;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 12px 30px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 15px 40px;
    font-size: 1.125rem;
}

/* ─── Hero Section ───────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    padding: 80px 0;
    text-align: center;
    color: var(--white);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Product Grid ───────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.product-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.product-image {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    background: var(--light-gray);
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: var(--white);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
}

.product-info {
    padding: 20px;
}

.product-category {
    font-size: 0.875rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.product-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark);
}

.product-name a:hover {
    color: var(--primary);
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.product-actions .btn {
    flex: 1;
}

/* ─── Product Detail ─────────────────────────────────────── */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-top: 30px;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gallery-main {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.gallery-main img {
    width: 100%;
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
}

.thumb {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.thumb.active {
    border-color: var(--primary);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-info h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.product-detail-price {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 20px;
}

.product-description {
    color: var(--gray);
    margin-bottom: 30px;
    line-height: 1.8;
}

.product-meta {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.product-meta p {
    margin-bottom: 10px;
}

.product-meta strong {
    color: var(--dark);
}

.qty-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.qty-selector label {
    font-weight: 600;
}

.qty-selector input {
    width: 80px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
}

/* ─── Cart ───────────────────────────────────────────────── */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
}

.cart-table th,
.cart-table td {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.cart-table th {
    background: var(--light-gray);
    font-weight: 600;
    color: var(--dark);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info h3 {
    font-size: 1.125rem;
    margin-bottom: 5px;
}

.cart-item-info a:hover {
    color: var(--primary);
}

.cart-qty-input {
    width: 60px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
}

.cart-remove {
    color: var(--error);
    cursor: pointer;
    font-size: 1.25rem;
}

.cart-remove:hover {
    opacity: 0.7;
}

.cart-summary {
    background: var(--light-gray);
    padding: 30px;
    border-radius: 8px;
    margin-top: 30px;
}

.cart-summary h3 {
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.125rem;
}

.summary-row.total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    padding-top: 15px;
    border-top: 2px solid var(--border);
}

/* ─── Checkout Form ──────────────────────────────────────── */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

/* ─── Contact Page ───────────────────────────────────────── */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 165, 165, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ─── Newsletter ─────────────────────────────────────────── */
.newsletter-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 60px 0;
    color: var(--white);
}

.newsletter-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.newsletter-text h3 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.newsletter-form {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.newsletter-form input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
}

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
    background: var(--dark);
    color: var(--white);
    padding: 60px 0 20px;
}

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

.footer-logo {
    margin-bottom: 15px;
}

.footer-logo .logo-main {
    color: var(--white);
    font-size: 1.5rem;
}

.footer-logo .logo-sub {
    color: var(--gray);
}

.footer-about {
    color: var(--gray);
    margin-bottom: 20px;
    line-height: 1.8;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-col h4 {
    font-size: 1.125rem;
    margin-bottom: 20px;
    color: var(--white);
}

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

.footer-col li {
    margin-bottom: 12px;
}

.footer-col a {
    color: var(--gray);
}

.footer-col a:hover {
    color: var(--primary);
}

.contact-list i {
    margin-right: 10px;
    color: var(--primary);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-wrap: wrap;
    gap: 20px;
}

.footer-bottom p {
    color: var(--gray);
}

.heart {
    color: var(--primary);
}

.footer-links {
    display: flex;
    gap: 20px;
    list-style: none;
}

/* ─── Toast Notification ─────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast i {
    font-size: 1.25rem;
}

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.pagination ul {
    display: flex;
    gap: 5px;
    list-style: none;
}

.pagination a {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--dark);
}

.pagination a:hover,
.pagination li.active a {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ─── Admin Styles ───────────────────────────────────────── */
.admin-header {
    background: var(--dark);
    color: var(--white);
    padding: 15px 0;
}

.admin-nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.admin-nav a {
    color: var(--white);
    font-weight: 500;
}

.admin-nav a:hover {
    color: var(--primary);
}

.admin-content {
    padding: 40px 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--light-gray);
    font-weight: 600;
}

.admin-table img {
    max-width: 60px;
    border-radius: 4px;
}

.admin-actions {
    display: flex;
    gap: 10px;
}

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

.stat-card {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-card h4 {
    color: var(--gray);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* ─── Responsive Design ──────────────────────────────────── */
@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--white);
        padding: 80px 30px 30px;
        transition: var(--transition);
        z-index: 1050;
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav a {
        padding: 15px 0;
        border-bottom: 1px solid var(--border);
    }
    
    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding-left: 20px;
    }
    
    .mobile-menu-toggle {
        display: flex;
        z-index: 1002;
    }
    
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: auto;
        right: min(300px, 80vw); /* Stop at the nav panel's left edge — never covers the nav */
        height: 100%;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .product-detail {
        grid-template-columns: 1fr;
    }
    
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .newsletter-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .newsletter-form {
        width: 100%;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .cart-table {
        font-size: 0.875rem;
    }
    
    .cart-table th,
    .cart-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .cart-table {
        display: block;
        overflow-x: auto;
    }
}

/* ─── Utilities ──────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }
.hidden { display: none; }
