/* ===========================
   RESET & BASE STYLES
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Nucleon Nutrition Color Palette */
    --primary-purple: #7D4F9D;
    --primary-purple-dark: #6A4186;
    --primary-purple-light: #9865B5;

    --accent-blue: #0869EB;
    --accent-blue-dark: #0657C9;

    --dark-navy: #1A212C;
    --dark-charcoal: #2A3342;

    --white: #FFFFFF;
    --light-gray: #F8F9FA;
    --medium-gray: #666666;
    --border-gray: #E0E0E0;

    --text-primary: #000000;
    --text-secondary: #666666;
    --text-light: #999999;

    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.15);
    --shadow-purple: 0 4px 12px rgba(125, 79, 157, 0.2);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font-family);
    background: var(--white);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

/* ===========================
   HEADER
   =========================== */
.header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-dark) 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    animation: fadeInDown 0.6s ease-out;
}

.header-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: var(--spacing-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.header-title {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    color: var(--white);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.header-download-info {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: calc(var(--spacing-2xl) * -0.75);
    margin-bottom: var(--spacing-xl);
    font-weight: 500;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--spacing-md);
    line-height: 1.5;
}

/* ===========================
   CALCULATOR CARD
   =========================== */
.calculator-card {
    background: var(--white);
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

/* ===========================
   FORM STYLES
   =========================== */
.calculator-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Input Styles */
.form-input,
.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--white);
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    transition: all 0.3s ease;
    outline: none;
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(125, 79, 157, 0.1);
}

.form-input:hover:not(:focus),
.form-select:hover:not(:focus) {
    border-color: var(--medium-gray);
}

/* Select specific */
.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 20px;
    padding-right: 3rem;
}

/* Input with Unit */
.input-wrapper {
    position: relative;
}

.input-wrapper .form-input {
    padding-right: 4rem;
}

.input-unit {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--white);
    background: var(--primary-purple);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

/* Input Hint */
.input-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===========================
   PRODUCT SELECTOR
   =========================== */
.product-selector {
    margin-top: var(--spacing-md);
}

.selector-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.selector-divider::before,
.selector-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-gray);
}

.selector-divider span {
    padding: 0 var(--spacing-md);
}

.product-dropdown-wrapper {
    position: relative;
}

.product-dropdown-trigger {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--white);
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    transition: all 0.3s ease;
    text-align: left;
}

.product-dropdown-trigger:hover {
    border-color: var(--medium-gray);
}

.product-dropdown-trigger:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(125, 79, 157, 0.1);
}

.product-dropdown-trigger.active {
    border-color: var(--primary-purple);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-placeholder {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.product-dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Selected product display */
.selected-product {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
}

.selected-product img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.selected-product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.selected-product-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-product-amount {
    font-size: 0.75rem;
    color: var(--primary-purple);
    font-weight: 600;
}

/* Dropdown menu */
.product-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--primary-purple);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.product-dropdown-menu.hidden {
    display: none;
}

/* Custom scrollbar */
.product-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.product-dropdown-menu::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 4px;
}

.product-dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--primary-purple-light);
    border-radius: 4px;
}

.product-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: var(--primary-purple);
}

/* Product option */
.product-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-xl);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-gray);
}

.product-option:last-child {
    border-bottom: none;
}

.product-option:hover {
    background: rgba(125, 79, 157, 0.08);
}

.product-option:active {
    background: rgba(125, 79, 157, 0.15);
}

.product-thumbnail {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-gray);
    background: var(--light-gray);
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-amount {
    font-size: 0.8125rem;
    color: var(--primary-purple);
    font-weight: 600;
}

/* ===========================
   SUBMIT BUTTON
   =========================== */
.submit-button {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-purple);
    font-family: var(--font-family);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(125, 79, 157, 0.3);
    background: linear-gradient(135deg, var(--primary-purple-light) 0%, var(--primary-purple) 100%);
}

.submit-button:active {
    transform: translateY(0);
}

.button-icon {
    width: 22px;
    height: 22px;
}

/* ===========================
   RESULT CARD
   =========================== */
.result-card {
    background: var(--white);
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out;
}

.result-card.hidden {
    display: none;
}

.result-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--light-gray);
}

.result-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-icon.success {
    background: rgba(16, 185, 129, 0.1);
}

.result-icon svg {
    width: 32px;
    height: 32px;
    color: var(--success-color);
}

.result-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.result-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-content {
    margin-bottom: var(--spacing-lg);
}

.result-main {
    background: linear-gradient(135deg, rgba(125, 79, 157, 0.08) 0%, rgba(125, 79, 157, 0.12) 100%);
    border: 2px solid var(--primary-purple);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.result-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.result-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-purple);
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.result-unit-label {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Warning Box */
.warning-box {
    background: rgba(245, 158, 11, 0.08);
    border: 2px solid var(--warning-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
}

.warning-icon {
    width: 28px;
    height: 28px;
    color: var(--warning-color);
    flex-shrink: 0;
}

.warning-box p {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.warning-box strong {
    color: var(--warning-color);
    font-weight: 700;
}

/* ===========================
   INFO BOX
   =========================== */
.info-box {
    background: var(--dark-navy);
    color: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s ease-out 0.3s backwards;
}

.info-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    color: var(--white);
}

.info-list {
    padding-left: var(--spacing-lg);
    color: rgba(255, 255, 255, 0.9);
}

.info-list li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
}

/* ===========================
   FOOTER
   =========================== */
.footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    animation: fadeIn 0.6s ease-out 0.4s backwards;
}

.footer p {
    margin-bottom: var(--spacing-xs);
}

.footer-disclaimer {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-style: italic;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }

    .header {
        padding: var(--spacing-lg);
    }

    .header-title {
        font-size: 1.75rem;
    }

    .calculator-card,
    .info-box {
        padding: var(--spacing-lg);
    }

    .result-value {
        font-size: 3rem;
    }

    .result-unit-label {
        font-size: 1rem;
    }

    .warning-box {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1.5rem;
    }

    .calculator-card {
        padding: var(--spacing-md);
    }

    .form-input,
    .form-select {
        padding: 0.75rem 0.875rem;
        font-size: 0.9375rem;
    }

    .submit-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .result-value {
        font-size: 2.5rem;
    }
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.hidden {
    display: none !important;
}

/* ===========================
   POPUP BANNER
   =========================== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-md);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.4s ease-out;
}

.popup-content {
    position: relative;
    max-width: 400px;
    width: 100%;
    animation: zoomIn 0.4s ease-out;
}

.popup-link {
    display: block;
    position: relative;
    text-decoration: none;
}

.popup-cta {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-blue);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(8, 105, 235, 0.4);
    white-space: nowrap;
    transition: all 0.3s ease;
    border: 2px solid var(--white);
    letter-spacing: 0.5px;
}

.popup-link:hover .popup-cta {
    background: var(--accent-blue-dark);
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(8, 105, 235, 0.5);
}

.popup-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.02);
}

.popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    font-family: var(--font-family);
    letter-spacing: 0.5px;
}

.popup-close:hover {
    color: var(--primary-purple-light);
    transform: scale(1.05);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}
