/* ===== CSS Variables ===== */
:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --secondary-dark: #059669;
    --accent: #F59E0B;
    --dark: #1F2937;
    --dark-light: #374151;
    --gray: #6B7280;
    --gray-light: #9CA3AF;
    --gray-lighter: #E5E7EB;
    --light: #F3F4F6;
    --white: #FFFFFF;
    --danger: #EF4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

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

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

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

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

.btn-success:hover {
    background: var(--secondary-dark);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    z-index: 1000;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-au {
    color: var(--primary);
}

.nav ul {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: var(--dark);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav a:hover::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--dark);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Hero Section ===== */
.hero {
    padding: 8rem 0 4rem;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    min-height: 90vh;
    display: flex;
    align-items: center;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    gap: 3rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--gray);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mattress-visual {
    width: 400px;
    height: 300px;
    perspective: 1000px;
}

.mattress-layers {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(20deg) rotateY(-20deg);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: rotateX(20deg) rotateY(-20deg) translateY(0); }
    50% { transform: rotateX(20deg) rotateY(-20deg) translateY(-20px); }
}

.layer {
    position: absolute;
    width: 300px;
    height: 200px;
    border-radius: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.layer-1 {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    bottom: 0;
    box-shadow: 0 20px 40px rgba(79, 70, 229, 0.4);
}

.layer-2 {
    background: linear-gradient(135deg, #818CF8 0%, #A78BFA 100%);
    bottom: 30px;
    width: 280px;
    height: 180px;
}

.layer-3 {
    background: linear-gradient(135deg, #C4B5FD 0%, #DDD6FE 100%);
    bottom: 55px;
    width: 260px;
    height: 160px;
}

/* ===== Section Styles ===== */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dark);
}

.section-header p {
    font-size: 1.125rem;
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Products Section ===== */
.products-section {
    padding: 5rem 0;
    background: var(--white);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light);
    border-radius: var(--radius-lg);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: var(--gray);
    font-size: 0.875rem;
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-lighter);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.view-toggle {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem;
    border: 1px solid var(--gray-lighter);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray);
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

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

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

.product-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.25rem 0.75rem;
    background: var(--accent);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    z-index: 1;
}

.product-badge.best-seller {
    background: var(--secondary);
}

.product-badge.premium {
    background: var(--primary);
}

.product-image {
    height: 180px;
    background: linear-gradient(135deg, var(--light) 0%, var(--gray-lighter) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.product-image-placeholder {
    width: 150px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.product-content {
    padding: 1.5rem;
}

.product-brand {
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.product-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.stars {
    color: var(--accent);
    font-size: 0.875rem;
}

.rating-count {
    font-size: 0.75rem;
    color: var(--gray);
}

.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feature-tag {
    padding: 0.25rem 0.5rem;
    background: var(--light);
    color: var(--gray);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.price-current {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.price-original {
    font-size: 1rem;
    color: var(--gray);
    text-decoration: line-through;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

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

.compare-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
}

.compare-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Products Table */
.products-table-container {
    overflow-x: auto;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.products-table th,
.products-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-lighter);
}

.products-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}

.products-table tr:hover {
    background: var(--light);
}

.products-table .product-name {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.products-table .product-thumb {
    width: 60px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: var(--radius-sm);
}

/* ===== Quiz Section ===== */
.quiz-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
}

.quiz-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.quiz-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 8px;
    background: var(--gray-lighter);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 20%;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--gray);
}

.quiz-question {
    margin-bottom: 2rem;
}

.quiz-question h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.quiz-options {
    display: grid;
    gap: 1rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border: 2px solid var(--gray-lighter);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.quiz-option:hover {
    border-color: var(--primary-light);
    background: var(--light);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: #EEF2FF;
}

.quiz-option input {
    display: none;
}

.quiz-option-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.quiz-option-text {
    font-weight: 500;
    color: var(--dark);
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.quiz-results {
    text-align: center;
}

.quiz-results h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.quiz-results p {
    color: var(--gray);
    margin-bottom: 2rem;
}

.recommended-products {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.recommended-product {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--light);
    border-radius: var(--radius);
    text-align: left;
}

.recommended-rank {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.recommended-info {
    flex: 1;
}

.recommended-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.recommended-info p {
    font-size: 0.875rem;
    color: var(--gray);
    margin: 0;
}

/* ===== Compare Section ===== */
.compare-section {
    padding: 5rem 0;
    background: var(--white);
}

.compare-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.compare-slot {
    min-height: 200px;
    border: 2px dashed var(--gray-lighter);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.compare-slot:hover {
    border-color: var(--primary);
    background: var(--light);
}

.slot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray);
}

.plus-icon {
    width: 50px;
    height: 50px;
    border: 2px solid var(--gray-lighter);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--gray);
}

.slot-filled {
    width: 100%;
    padding: 1.5rem;
    text-align: center;
}

.slot-filled .slot-content h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.slot-filled .slot-content p {
    font-size: 0.875rem;
    color: var(--gray);
}

.remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-btn:hover {
    background: #DC2626;
}

.compare-table-container {
    overflow-x: auto;
    margin-top: 2rem;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.compare-table th,
.compare-table td {
    padding: 1rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-lighter);
}

.compare-table tr td:first-child,
.compare-table tr th:first-child {
    text-align: left;
    font-weight: 600;
    background: var(--light);
    color: var(--dark);
}

.compare-table .highlight {
    background: #DCFCE7;
    font-weight: 600;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-lighter);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 35px;
    height: 35px;
    border: none;
    background: var(--light);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--gray-lighter);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-product {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--gray-lighter);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

.modal-product:hover {
    border-color: var(--primary);
    background: var(--light);
}

.modal-product-thumb {
    width: 60px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: var(--radius-sm);
}

.modal-product-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.modal-product-info p {
    font-size: 0.75rem;
    color: var(--gray);
}

/* ===== Guide Section ===== */
.guide-section {
    padding: 5rem 0;
    background: var(--light);
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.guide-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.guide-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

.guide-card p {
    color: var(--gray);
    line-height: 1.7;
}

/* ===== SEO Section ===== */
.seo-section {
    padding: 5rem 0;
    background: var(--white);
}

.seo-content {
    max-width: 900px;
    margin: 0 auto;
}

.seo-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.seo-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.seo-content p {
    color: var(--gray);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.seo-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.seo-content ul li {
    color: var(--gray);
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 1rem;
    line-height: 1.7;
}

.seo-content ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* ===== Footer ===== */
.footer {
    background: var(--dark);
    color: var(--white);
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand .logo {
    margin-bottom: 1rem;
}

.footer-brand .logo a {
    color: var(--white);
}

.footer-brand p {
    color: var(--gray-light);
    line-height: 1.7;
}

.footer-column h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--white);
}

.footer-column ul li {
    margin-bottom: 0.75rem;
}

.footer-column a {
    color: var(--gray-light);
    transition: var(--transition);
}

.footer-column a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--dark-light);
    text-align: center;
}

.footer-bottom p {
    color: var(--gray-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.affiliate-disclosure {
    font-size: 0.75rem !important;
    color: var(--gray) !important;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

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

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

    .hero-image {
        display: none;
    }

    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 1rem;
        box-shadow: var(--shadow);
    }

    .nav.active {
        display: block;
    }

    .nav ul {
        flex-direction: column;
        gap: 0;
    }

    .nav a {
        display: block;
        padding: 1rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        margin-left: 0;
        justify-content: center;
    }

    .compare-slots {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .quiz-container {
        padding: 1.5rem;
    }

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

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

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}
