:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient-start: #f3f4f6;
    --bg-gradient-end: #e5e7eb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(255, 255, 255, 0.5);
    --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --font-sans: 'Inter', 'Noto Sans JP', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient-start: #111827;
        --bg-gradient-end: #0f172a;
        --text-main: #f9fafb;
        --text-muted: #9ca3af;
        --card-bg: rgba(31, 41, 55, 0.7);
        --border-color: rgba(255, 255, 255, 0.1);
        --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Abstract Background Blob */
.background-glob {
    position: absolute;
    top: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 600px;
    z-index: 1;
}

.app-header {
    background: url('../assets/header-bg.jpg') no-repeat center center;
    background-size: cover;
    /* Aspect Ratio 4:1 maintainance */
    width: 100%;
    padding-top: 25%;
    /* 4:1 aspect ratio based on width */
    height: 0;

    border-radius: 20px;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Image Replacement Technique: Hide text visually but keep for SEO */
.logo-container,
.app-header p,
.app-header h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.header-tagline {
    text-align: center;
    color: #4b5563;
    font-size: 1rem;
    font-weight: 500;
    margin: -1.5rem auto 2rem;
    /* Pull up slightly closer to image */
    max-width: 600px;
    line-height: 1.6;
}

/* Mobile adjustments if needed */
@media (max-width: 640px) {
    .app-header {
        border-radius: 12px;
        /* Increase height relative to width on mobile if needed, or keep 4:1 */
        padding-top: 40%;
        /* Make it taller on mobile to see details */
    }
}

.header-icon {
    width: 80px;
    height: 100px;
    margin: 0 auto 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.header-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(79, 70, 229, 0.2));
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Calculator Card */
.calculator-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 2rem;
    transition: transform 0.3s ease;
}

.calculator-card:hover {
    transform: translateY(-2px);
}

.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.optional {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: normal;
}

.optional.recommend {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    font-family: var(--font-sans);
    border: 2px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    box-shadow: var(--shadow-inner);
    transition: all 0.2s;
    outline: none;
}

.input-wrapper input:focus,
.select-wrapper select:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    animation: borderGlow 2s ease-in-out infinite;
}

.input-wrapper .unit {
    position: absolute;
    right: 3rem;
    color: var(--text-muted);
    font-weight: 500;
    pointer-events: none;
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper select {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    /* Slightly smaller than input number */
    font-family: var(--font-sans);
    border: 2px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    box-shadow: var(--shadow-inner);
    transition: all 0.2s;
    outline: none;
    appearance: none;
    cursor: pointer;
}

.select-wrapper .chevron {
    position: absolute;
    right: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}


.input-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    /* Lighter gray */
    font-weight: 400;
    /* Normal weight */
}

/* Results Area */
.results-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.result-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: 16px;
}

.result-item {
    background: rgba(255, 255, 255, 0.6);
    padding: 1rem;
    border-radius: 16px;
    text-align: center;
    animation: fadeInScale 0.5s ease-out backwards;
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -200%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.4),
            transparent);
    animation: shimmer 2s ease-in-out infinite;
}

/* Stagger animation delays for each card */
.result-item:nth-child(1) {
    animation-delay: 0s;
}

.result-item:nth-child(2) {
    animation-delay: 0.1s;
}

.result-item:nth-child(3) {
    animation-delay: 0.2s;
}

.result-item:nth-child(4) {
    animation-delay: 0.3s;
}

.result-item:nth-child(5) {
    animation-delay: 0.4s;
}

.result-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Enhanced Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes borderGlow {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    }

    50% {
        box-shadow:
            0 0 0 4px rgba(79, 70, 229, 0.2),
            0 0 20px rgba(79, 70, 229, 0.4),
            0 0 40px rgba(79, 70, 229, 0.2);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}


/* Info Section */
.info-section {
    max-width: 600px;
    width: 100%;
    margin-top: 3rem;
}

.info-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-main);
}

.measurement-visual {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.measurement-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    flex-shrink: 0;
}


/* Methodology Card */
.methodology-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 2rem;
}

.methodology-card h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.methodology-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.formula-section {
    background: rgba(79, 70, 229, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

.formula-section h4 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.formula-section ul {
    list-style: none;
    padding: 0;
}

.formula-section li {
    color: var(--text-muted);
    padding: 0.5rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}

.formula-section li strong {
    color: var(--primary-color);
    font-weight: 600;
}

.disclaimer {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
    color: #92400e;
    line-height: 1.6;
    font-size: 0.95rem;
}

.disclaimer strong {
    color: #b45309;
    display: block;
    margin-bottom: 0.25rem;
}

/* Standards Section */
.standards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.standard-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 1.25rem;
    transition: transform 0.2s;
}

.standard-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.8);
}

.standard-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.standard-header .flag {
    font-size: 1.5rem;
}

.standard-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.standard-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Brand Grid Layout */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.brand-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    /* Remove default link styles */
    color: inherit;
    position: relative;
    overflow: hidden;
}

.brand-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* Brand Image Styles */
.brand-image-area {
    width: 100%;
    aspect-ratio: 16/9;
    /* Flexible height based on width */
    height: auto;
    /* Remove fixed height */
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #fff;
    /* White background for product images */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    /* Add breathing room */
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border */
}

.brand-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensure whole shoe is visible */
    transition: transform 0.3s ease;
}

.brand-card:hover .brand-img {
    transform: scale(1.05);
}

.brand-placeholder {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0.5;
}

.brand-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.brand-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 0.5rem;
}

.brand-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.brand-card h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 700;
}

.brand-model {
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    font-style: italic;
}

.brand-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: var(--bg-secondary);
    color: var(--primary-color);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.brand-features {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-grow: 1;
}

.brand-features li {
    margin-bottom: 0.4rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--accent-color);
}

/* Removed explicit brand-link button styles since card is clickable */


/* FAQ Section */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s;
}

.faq-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

.faq-question {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 0.75rem 0;
}

.faq-answer {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.faq-answer strong {
    color: var(--text-main);
    font-weight: 600;
}

/* Mobile Optimizations */
@media (max-width: 768px) {

    /* Ensure tap targets are at least 44x44px */
    .gender-btn {
        padding: 1rem 0.75rem;
        min-height: 44px;
    }

    .action-btn {
        padding: 1rem 1.5rem;
        min-height: 44px;
    }

    .input-wrapper input {
        padding: 1.125rem 1.5rem;
        font-size: 1.25rem;
    }

    /* Better spacing on mobile */
    .calculator-card,
    .info-section {
        padding: 1.5rem;
    }

    .tips-grid {
        grid-template-columns: 1fr;
    }
}


.app-footer {
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Success Message */
/* Success Message */
.success-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    animation: fadeInScale 0.4s ease-out;
    margin-bottom: 0.5rem;
}

.success-message::before {
    content: none;
}

/* CSS Confetti Particles */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    animation: confetti 3s ease-out forwards;
    opacity: 0;
}

.confetti:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    background: #ef4444;
}

.confetti:nth-child(2) {
    left: 20%;
    animation-delay: 0.1s;
    background: #f59e0b;
}

.confetti:nth-child(3) {
    left: 30%;
    animation-delay: 0.2s;
    background: #10b981;
}

.confetti:nth-child(4) {
    left: 40%;
    animation-delay: 0.3s;
    background: #3b82f6;
}

.confetti:nth-child(5) {
    left: 50%;
    animation-delay: 0.4s;
    background: #8b5cf6;
}

.confetti:nth-child(6) {
    left: 60%;
    animation-delay: 0.1s;
    background: #ec4899;
}

.confetti:nth-child(7) {
    left: 70%;
    animation-delay: 0.2s;
    background: #06b6d4;
}

.confetti:nth-child(8) {
    left: 80%;
    animation-delay: 0.3s;
    background: #f97316;
}

.confetti:nth-child(9) {
    left: 90%;
    animation-delay: 0.4s;
    background: #84cc16;
}


/* Responsive adjustments */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 2rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .results-container {
        grid-template-columns: 1fr;
    }
}



/* Radio Buttons Custom Style (Input Group - Gender) */
.gender-selector {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

.gender-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.gender-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.gender-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
    box-shadow: 0 0 0 1px #3b82f6 inset;
    font-weight: 600;
}

/* Action Buttons (Save & Share) */
.action-buttons {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.save-btn {
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    color: white;
}

.save-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), #6366f1);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.share-btn {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-main);
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 1);
}

.share-btn.twitter {
    background: linear-gradient(135deg, #1da1f2, #0d8bd9);
    color: white;
}

.share-btn.twitter:hover {
    background: linear-gradient(135deg, #0d8bd9, #0a6fb8);
}

.share-btn.line {
    background: linear-gradient(135deg, #00b900, #009900);
    color: white;
}

.share-btn.line:hover {
    background: linear-gradient(135deg, #009900, #007700);
}

.btn-icon {
    font-size: 1.2rem;
}

/* History Section */
.history-section {
    margin-top: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.toggle-btn {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: rgba(79, 70, 229, 0.2);
}

.history-content {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.9);
}

.history-info {
    flex: 1;
}

.history-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.history-sizes {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.size-badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

.clear-all-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.empty-history {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Mobile Responsive for new features */
@media (max-width: 480px) {
    .share-buttons {
        grid-template-columns: 1fr;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .delete-btn {
        align-self: flex-end;
    }
}

/* =========================================
   Affiliate Section
   ========================================= */
.affiliate-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    animation: fadeIn 0.5s ease-out;
}

.affiliate-section h3 {
    font-size: 1.25rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.affiliate-description {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.affiliate-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* Product Card */
.product-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.product-image-wrapper {
    width: 100%;
    aspect-ratio: 1;
    /* Square image */
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    align-self: flex-start;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #dc2626;
    /* Amazon price color-ish */
    margin-top: auto;
    margin-bottom: 1rem;
}

.amazon-btn {
    background: #FF9900;
    /* Amazon Orange */
    color: white;
    /* Accessible? Maybe black is better for amazon orange, but white looks cleaner. Amazon uses black on orange usually. Let's try simplified style. */
    background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
    border: 1px solid #a88734;
    color: #111;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem;
    border-radius: 8px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: filter 0.2s;
}

.amazon-btn:hover {
    filter: brightness(1.05);
    text-decoration: none;
}

.amazon-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Perfect Fit Luxury Card */
.perfect-fit-card {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 2px solid #fbbf24;
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(251, 191, 36, 0.4);
    animation: fadeInScale 0.5s ease-out backwards, borderGlowGold 3s infinite;
    position: relative;
    overflow: hidden;
}

.perfect-fit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
    opacity: 0.5;
    animation: rotateLight 10s linear infinite;
    pointer-events: none;
}

.perfect-fit-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #b45309;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(251, 191, 36, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.text-gradient {
    background: linear-gradient(to right, #b45309, #d97706, #b45309);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: shineText 3s linear infinite;
}

.perfect-fit-content {
    position: relative;
    z-index: 1;
}

.pf-value {
    font-size: 2rem;
    font-weight: 900;
    color: #d97706;
    margin: 0.25rem 0;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.pf-desc {
    font-size: 1rem;
    color: #92400e;
    font-weight: 600;
}

@keyframes borderGlowGold {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4);
        border-color: #fbbf24;
    }

    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
        border-color: #f59e0b;
    }
}

@keyframes rotateLight {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes shineText {
    to {
        background-position: 200% center;
    }
}

/* Analyzying State */
.analyzing-state {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    animation: pulse 1.5s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* =========================================
   SEO Content Sections
   ========================================= */

/* Size Table */
.size-table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.size-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    overflow: hidden;
}

.size-table thead {
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
    color: white;
}

.size-table th,
.size-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.size-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.05);
}

.table-note {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

/* Foot Type Cards */
.foot-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.foot-type-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.foot-type-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.foot-type-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.type-percentage {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.type-tip {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
}

/* Affiliate CTA Card in Foot Type Grid */
/* Affiliate CTA Card in Foot Type Grid */
.affiliate-cta-card {
    background: #fff;
    border: 2px solid #fdba74;
    /* Orange-300 */
    color: #1f2937;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.1), 0 2px 4px -1px rgba(249, 115, 22, 0.06);
}

.affiliate-cta-card h3 {
    color: #c2410c;
    /* Orange-700 */
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.affiliate-cta-card .cta-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: transparent;
}

.affiliate-cta-card p {
    color: #4b5563;
    /* Gray-600 */
    font-size: 0.95rem;
    line-height: 1.5;
}

.cta-button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: #f97316;
    /* Orange-500 */
    color: white;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(249, 115, 22, 0.25);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.cta-button:hover {
    background: #ea580c;
    /* Orange-600 */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(249, 115, 22, 0.3);
    color: white;
}

/* Tips Grid */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.tip-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s;
}

.tip-card:hover {
    transform: translateY(-2px);
}

.tip-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.tip-card h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.tip-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* FAQ Section */
.faq-container {
    margin-top: 1.5rem;
}

.faq-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-item summary {
    padding: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.faq-item summary:hover {
    background: rgba(79, 70, 229, 0.05);
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    padding: 0 1.25rem 1.25rem 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Mobile Responsive for SEO Sections */
@media (max-width: 768px) {

    .size-table th,
    .size-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    .foot-type-grid,
    .tips-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Layout Adjustments */
@media (max-width: 640px) {

    /* Force 2 columns for results */
    .results-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Force 2 columns for brand grid to avoid empty space */
    .brand-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    /* Compact styling for brand cards in 2-column mobile view */
    .brand-card {
        padding: 0.75rem;
    }

    .brand-header-row h3 {
        font-size: 0.9rem;
    }

    .brand-tags .tag {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }

    .brand-features {
        font-size: 0.75rem;
        padding-left: 1rem;
    }

    .brand-features li {
        margin-bottom: 0.1rem;
    }
}

/* Confetti Styles for Perfect Fit */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0c14b;
    animation: confetti 1.5s ease-out forwards;
    top: 100%;
    left: 50%;
    opacity: 0;
    border-radius: 50%;
}

/* Randomize confetti start positions */
.confetti:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    background: #ef4444;
}

.confetti:nth-child(2) {
    left: 20%;
    animation-delay: 0.1s;
    background: #3b82f6;
}

.confetti:nth-child(3) {
    left: 30%;
    animation-delay: 0.2s;
    background: #10b981;
}

.confetti:nth-child(4) {
    left: 40%;
    animation-delay: 0s;
    background: #f59e0b;
}

.confetti:nth-child(5) {
    left: 50%;
    animation-delay: 0.1s;
    background: #8b5cf6;
}

.confetti:nth-child(6) {
    left: 60%;
    animation-delay: 0.2s;
    background: #ec4899;
}

.confetti:nth-child(7) {
    left: 70%;
    animation-delay: 0s;
    background: #ef4444;
}

.confetti:nth-child(8) {
    left: 80%;
    animation-delay: 0.1s;
    background: #3b82f6;
}

.confetti:nth-child(9) {
    left: 90%;
    animation-delay: 0.2s;
    background: #10b981;
}

/* Remove arrows/spinners from number input */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    /* Firefox */
}

/* Fix gender button size */
.gender-btn {
    padding: 0.5rem 1rem !important;
    height: auto !important;
    min-height: 0 !important;
}

/* Sock Thickness Selector */
.sock-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 999px;
    padding: 0.25rem;
    gap: 0.25rem;
}

.sock-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.sock-btn.active {
    background: #fff;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Affiliate Mockup */
.affiliate-mockup {
    margin-top: 1rem;
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    /* Create stacking context */
    z-index: 5;
    /* Ensure it stays above the rotating light effect of the parent card */
}

.mockup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mockup-tag {
    background: #10b981;
    color: white;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.mockup-brand {
    font-weight: 600;
    letter-spacing: 0.05em;
}

.mockup-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    /* Pure white background */
    display: flex;
    align-items: center;
    justify-content: center;
}

.mockup-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
    opacity: 1;
    /* Ensure no transparency */
}

.affiliate-mockup:hover .mockup-image img {
    /* transform: scale(1.05); Removed to prevent hover bleed from button */
}

.mockup-image:hover img {
    transform: scale(1.05);
}

.mockup-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-main);
}



.mockup-benefit {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.mockup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: #f59e0b;
    /* Amber */
    color: white;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.25);
}

.mockup-btn:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.3);
}

.mockup-btn .arrow {
    transition: transform 0.2s;
}

.mockup-btn:hover .arrow {
    transform: translateX(4px);
}