/**
 * Dog Food Calculator Styles
 * Using BEM naming convention
 * Color tokens based on Lemmix brand
 */

:root {
    /* Lemmix Color Tokens */
    --dfc-color-primary: #2d5f3d;
    --dfc-color-primary-dark: #1e4028;
    --dfc-color-primary-light: #3d7f4d;
    --dfc-color-secondary: #f4c4c4;
    --dfc-color-secondary-dark: #e8a8a8;
    --dfc-color-background: #fffaed;
    --dfc-color-background-alt: #ffffff;
    --dfc-color-text: #2c2c2c;
    --dfc-color-text-light: #666666;
    --dfc-color-border: #e0e0e0;
    --dfc-color-success: #4caf50;
    --dfc-color-error: #f44336;

    /* Spacing Tokens */
    --dfc-spacing-xs: 0.5rem;
    --dfc-spacing-sm: 1rem;
    --dfc-spacing-md: 1.5rem;
    --dfc-spacing-lg: 2rem;
    --dfc-spacing-xl: 3rem;

    /* Border Radius Tokens */
    --dfc-radius-sm: 4px;
    --dfc-radius-md: 8px;
    --dfc-radius-lg: 12px;
    --dfc-radius-xl: 16px;

    /* Typography Tokens */
    --dfc-font-size-sm: 0.875rem;
    --dfc-font-size-base: 1rem;
    --dfc-font-size-lg: 1.125rem;
    --dfc-font-size-xl: 1.5rem;
    --dfc-font-size-2xl: 2rem;

    /* Shadow Tokens */
    --dfc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --dfc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --dfc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transition Tokens */
    --dfc-transition-fast: 150ms ease-in-out;
    --dfc-transition-base: 250ms ease-in-out;
    --dfc-transition-slow: 350ms ease-in-out;
}

/* Block: dfc */
.dfc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--dfc-color-text);
    line-height: 1.6;
}

/* Element: container */
.dfc__container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--dfc-spacing-lg);
    background: var(--dfc-color-background-alt);
    border-radius: var(--dfc-radius-lg);
    box-shadow: var(--dfc-shadow-md);
}

/* Element: title */
.dfc__title {
    font-size: var(--dfc-font-size-2xl);
    font-weight: 700;
    color: var(--dfc-color-primary);
    margin: 0 0 var(--dfc-spacing-lg) 0;
    text-align: center;
}

/* Element: section */
.dfc__section {
    margin-bottom: var(--dfc-spacing-sm);
}

/* Element: label */
.dfc__label {
    display: block;
    font-size: var(--dfc-font-size-base);
    font-weight: 600;
    color: var(--dfc-color-text);
    margin-bottom: var(--dfc-spacing-sm);
}

/* Modifier: required */
.dfc__label--required {
    position: relative;
}

.dfc__required {
    color: var(--dfc-color-error);
    margin-left: var(--dfc-spacing-xs);
}

/* Element: cards (container for dog type selection) */
.dfc__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--dfc-spacing-md);
}

/* Element: card */
.dfc__card {
    position: relative;
}

.dfc__radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.dfc__card-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: var(--dfc-spacing-lg);
    border: 3px solid var(--dfc-color-border);
    border-radius: var(--dfc-radius-lg);
    cursor: pointer;
    transition: all 300ms ease-in-out;
    min-height: 220px;
    position: relative;
    overflow: hidden;
    /* Background image set via inline style */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Gradient overlay for text readability */
.dfc__card-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
        rgba(255, 250, 237, 0.3) 0%,
        rgba(255, 250, 237, 0.6) 50%,
        rgba(255, 250, 237, 0.85) 100%
    );
    transition: opacity 300ms ease-in-out;
    z-index: 1;
}

.dfc__card-label:hover {
    border-color: var(--dfc-color-primary-light);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(45, 95, 61, 0.15);
}

.dfc__card-label:hover::before {
    opacity: 0.9;
}

.dfc__radio:checked + .dfc__card-label {
    border-color: var(--dfc-color-primary);
    box-shadow: 0 6px 16px rgba(45, 95, 61, 0.25);
}

.dfc__radio:checked + .dfc__card-label::before {
    background: linear-gradient(to bottom,
        rgba(45, 95, 61, 0.5) 0%,
        rgba(45, 95, 61, 0.75) 50%,
        rgba(45, 95, 61, 0.9) 100%
    );
}

.dfc__radio:focus + .dfc__card-label {
    outline: 2px solid var(--dfc-color-primary);
    outline-offset: 2px;
}

/* Element: card-text */
.dfc__card-text {
    font-size: var(--dfc-font-size-lg);
    font-weight: 700;
    text-align: center;
    position: relative;
    z-index: 2;
    padding: var(--dfc-spacing-xs) var(--dfc-spacing-md);
    transition: all 300ms ease-in-out;
    color: var(--dfc-color-text);
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8),
                 0 2px 6px rgba(255, 255, 255, 0.5);
}

.dfc__card-label:hover .dfc__card-text {
    transform: translateY(-2px);
}

.dfc__radio:checked + .dfc__card-label .dfc__card-text {
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5),
                 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Element: select */
.dfc__select {
    width: 100%;
    padding: var(--dfc-spacing-sm);
    padding-right: calc(var(--dfc-spacing-sm) * 2 + 20px);
    font-size: var(--dfc-font-size-base);
    color: var(--dfc-color-text);
    background: white;
    border: 2px solid var(--dfc-color-border);
    border-radius: var(--dfc-radius-md);
    transition: border-color var(--dfc-transition-fast);
    cursor: pointer;
    /* Remove default appearance */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Add single custom arrow */
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%232d5f3d" d="M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z"/></svg>');
    background-repeat: no-repeat;
    background-position: right var(--dfc-spacing-sm) center;
    background-size: 12px;
}

/* Remove any pseudo-elements that themes might add */
.dfc__select::after,
.dfc__select::before {
    display: none !important;
    content: none !important;
}

.dfc__select:hover {
    border-color: var(--dfc-color-primary-light);
}

.dfc__select:focus {
    outline: none;
    border-color: var(--dfc-color-primary);
    box-shadow: 0 0 0 3px rgba(45, 95, 61, 0.1);
}

/* Element: input-group */
.dfc__input-group {
    flex: 1;
    min-width: 200px;
}

/* Modifier: input-group--full (spans full width when price is hidden) */
.dfc__input-group--full {
    flex: 1 1 100%;
    max-width: 100%;
}

/* Modifier: inputs */
.dfc__section--inputs {
    display: flex;
    gap: var(--dfc-spacing-md);
    flex-wrap: wrap;
}

/* Element: input */
.dfc__input {
    width: 100%;
    padding: var(--dfc-spacing-sm);
    font-size: var(--dfc-font-size-base);
    color: var(--dfc-color-text);
    background: white;
    border: 2px solid var(--dfc-color-border);
    border-radius: var(--dfc-radius-md);
    transition: border-color var(--dfc-transition-fast);
}

.dfc__input:hover {
    border-color: var(--dfc-color-primary-light);
}

.dfc__input:focus {
    outline: none;
    border-color: var(--dfc-color-primary);
    box-shadow: 0 0 0 3px rgba(45, 95, 61, 0.1);
}

.dfc__input::placeholder {
    color: var(--dfc-color-text-light);
}

/* Element: button */
.dfc__button-wrapper {
    margin-top: var(--dfc-spacing-lg);
}

.dfc__calculate-btn {
    display: block;
    width: 100%;
    padding: var(--dfc-spacing-sm) var(--dfc-spacing-md);
    font-size: var(--dfc-font-size-base);
    font-weight: 600;
    color: white;
    background: var(--dfc-color-primary);
    border: none;
    border-radius: var(--dfc-radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(45, 95, 61, 0.15);
    will-change: transform;
}

.dfc__calculate-btn:hover:not(:disabled) {
    background: var(--dfc-color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 95, 61, 0.25);
}

.dfc__calculate-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(45, 95, 61, 0.2);
}

.dfc__calculate-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 95, 61, 0.2), 0 2px 8px rgba(45, 95, 61, 0.15);
}

.dfc__calculate-btn:disabled {
    background: #BAC1AF;
    color: white;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.6;
}

/* Element: results */
.dfc__results {
    margin-top: var(--dfc-spacing-xl);
    padding: var(--dfc-spacing-lg);
    background: var(--dfc-color-background);
    border-radius: var(--dfc-radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 300ms ease-in-out;
}

.dfc__results-title {
    font-size: var(--dfc-font-size-xl);
    font-weight: 700;
    color: var(--dfc-color-primary);
    margin: 0 0 var(--dfc-spacing-lg) 0;
    text-align: center;
    transition: color 300ms ease-in-out;
}

/* Element: results-grid */
.dfc__results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--dfc-spacing-md);
    margin-bottom: var(--dfc-spacing-lg);
}

/* Element: result-item */
.dfc__result-item {
    background: white;
    padding: var(--dfc-spacing-md);
    border-radius: var(--dfc-radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: all 300ms ease-in-out;
    border: 2px solid transparent;
}

.dfc__result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(45, 95, 61, 0.12);
    border-color: var(--dfc-color-primary-light);
}

.dfc__result-label {
    display: block;
    font-size: var(--dfc-font-size-sm);
    color: var(--dfc-color-text-light);
    margin-bottom: var(--dfc-spacing-xs);
    transition: color 300ms ease-in-out;
}

.dfc__result-item:hover .dfc__result-label {
    color: var(--dfc-color-primary);
}

.dfc__result-value {
    font-size: var(--dfc-font-size-xl);
    font-weight: 700;
    color: var(--dfc-color-primary);
    transition: all 300ms ease-in-out;
}

.dfc__result-item:hover .dfc__result-value {
    transform: scale(1.05);
}

/* Element: disclaimer */
.dfc__disclaimer {
    margin: 0 0 var(--dfc-spacing-sm) 0;
    padding: var(--dfc-spacing-md);
    background: var(--dfc-color-secondary);
    border-radius: var(--dfc-radius-md);
    border-left: 4px solid var(--dfc-color-secondary-dark);
}

.dfc__disclaimer p {
    margin: 0;
    font-size: var(--dfc-font-size-sm);
    line-height: 1.6;
    color: var(--dfc-color-text);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dfc__container {
        padding: var(--dfc-spacing-md);
    }

    .dfc__title {
        font-size: var(--dfc-font-size-xl);
    }

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

    .dfc__section--inputs {
        flex-direction: column;
    }

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

    .dfc__result-value {
        font-size: var(--dfc-font-size-lg);
    }
}

@media (max-width: 480px) {
    .dfc__container {
        padding: var(--dfc-spacing-sm);
    }

    .dfc__card-label {
        min-height: 180px;
        padding: var(--dfc-spacing-md);
    }
}

/* Animation for results appearing */
@keyframes dfc-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dfc__results {
    animation: dfc-fadeIn 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stagger animation for result items */
.dfc__result-item {
    animation: dfc-fadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.dfc__result-item:nth-child(1) { animation-delay: 100ms; }
.dfc__result-item:nth-child(2) { animation-delay: 150ms; }
.dfc__result-item:nth-child(3) { animation-delay: 200ms; }
.dfc__result-item:nth-child(4) { animation-delay: 250ms; }
.dfc__result-item:nth-child(5) { animation-delay: 300ms; }

/* Print styles */
@media print {
    .dfc__container {
        box-shadow: none;
    }

    .dfc__card-label:hover {
        transform: none;
    }
}
