/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: url('https://images.unsplash.com/photo-1490645935967-10de6ba17061?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2053&q=80') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    position: relative;
}

/* Removed the colored overlay to show background image clearly */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 1s ease-out;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    padding: clamp(25px, 5vw, 40px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.header h1 i {
    color: #ffd700;
    margin-right: 15px;
    animation: pulse 2s infinite;
}

.header p {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: rgba(255,255,255,0.95);
    font-weight: 300;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.2);
}

/* Calculator Section */
.calculator-section {
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 40px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    animation: slideInUp 1s ease-out;
    border: 1px solid rgba(255,255,255,0.3);
}

.calculator-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: clamp(15px, 3vw, 25px);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: clamp(15px, 3vw, 20px);
    width: 100%;
    max-width: 100%;
}

.form-group label {
    font-weight: 600;
    margin-bottom: clamp(6px, 1.5vw, 8px);
    color: #555;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

.form-group input,
.form-group select {
    padding: clamp(12px, 2.5vw, 15px);
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    transition: all 0.3s ease;
    background: white;
    font-family: 'Poppins', sans-serif;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* Modern Unit Toggle Styles */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 8px);
    flex-wrap: wrap;
}

.input-with-unit input {
    flex: 1;
    border-radius: 12px;
    min-width: 0;
}

.unit-toggle {
    display: flex;
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    min-width: clamp(70px, 15vw, 80px);
    flex-shrink: 0;
}

.unit-btn {
    flex: 1;
    padding: clamp(10px, 2.5vw, 12px) clamp(8px, 2vw, 12px);
    border: none;
    background: transparent;
    color: #666;
    font-weight: 600;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

.unit-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.unit-btn:hover:not(.active) {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.unit-btn:first-child {
    border-radius: 10px 0 0 10px;
}

.unit-btn:last-child {
    border-radius: 0 10px 10px 0;
}

.input-with-unit input:focus + .unit-toggle {
    border-color: #667eea;
}

.input-with-unit input:focus + .unit-toggle .unit-btn.active {
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.4);
}

.imperial-inputs {
    margin-top: clamp(8px, 2vw, 10px);
    padding: clamp(12px, 3vw, 15px);
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e1e5e9;
}

.input-row {
    display: flex;
    gap: clamp(10px, 3vw, 15px);
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.input-group label {
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #666;
}

.input-group input {
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.calculate-btn {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: clamp(15px, 3vw, 18px) clamp(20px, 4vw, 30px);
    border-radius: 12px;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    font-family: 'Poppins', sans-serif;
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
    transform: translateY(-1px);
}

.calculate-btn i {
    margin-right: 10px;
}

/* Results Section */
.results-section {
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 40px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: slideInUp 1s ease-out;
    border: 1px solid rgba(255,255,255,0.3);
}

.results-section h2 {
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 30px;
    color: #333;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hidden {
    display: none;
}

/* Calorie Summary */
.calorie-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: clamp(15px, 3vw, 25px);
    margin-bottom: 40px;
}

.summary-card {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: clamp(20px, 4vw, 30px);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease-out;
}

.summary-card:nth-child(2) {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.3);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.card-icon {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

.summary-card h3 {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    margin-bottom: 15px;
    font-weight: 600;
}

.calorie-value {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Macronutrients Section */
.macros-section {
    margin-bottom: 40px;
}

.macros-section h3 {
    text-align: center;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 30px;
    color: #333;
}

.macros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: clamp(15px, 3vw, 25px);
}

.macro-card {
    background: white;
    padding: clamp(20px, 4vw, 25px);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border-top: 4px solid;
    animation: fadeInUp 0.8s ease-out;
}

.macro-card.protein {
    border-top-color: #ff6b6b;
}

.macro-card.carbs {
    border-top-color: #4ecdc4;
}

.macro-card.fats {
    border-top-color: #45b7d1;
}

.macro-card.fiber {
    border-top-color: #96ceb4;
}

.macro-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.macro-icon {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 15px;
    color: #667eea;
}

.macro-card h4 {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    margin-bottom: 15px;
    color: #333;
}

.macro-value {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    margin-bottom: 5px;
    color: #333;
}

.macro-percentage {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.macro-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.macro-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1.5s ease-out;
}

.protein-fill {
    background: linear-gradient(90deg, #ff6b6b, #ee5a24);
}

.carbs-fill {
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
}

.fats-fill {
    background: linear-gradient(90deg, #45b7d1, #96ceb4);
}

.fiber-fill {
    background: linear-gradient(90deg, #96ceb4, #ffeaa7);
}

/* Recommendations Section */
.recommendations {
    margin-bottom: 30px;
}

.recommendations h3 {
    text-align: center;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 30px;
    color: #333;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: clamp(15px, 3vw, 20px);
}

.recommendation-card {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    padding: clamp(20px, 4vw, 25px);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease-out;
}

.recommendation-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.recommendation-card i {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: #667eea;
    margin-bottom: 15px;
}

.recommendation-card h4 {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    margin-bottom: 10px;
    color: #333;
}

.recommendation-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Zigzag Section */
.zigzag-section {
    margin-bottom: 30px;
}

.zigzag-section h3 {
    text-align: center;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 15px;
    color: #333;
}

.zigzag-description {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 25px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.zigzag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: clamp(10px, 2vw, 15px);
    margin-bottom: 20px;
}

.zigzag-day {
    background: white;
    padding: clamp(15px, 3vw, 20px);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border-top: 3px solid;
    animation: fadeInUp 0.8s ease-out;
}

.zigzag-day:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.zigzag-day.high {
    border-top-color: #4ecdc4;
    background: linear-gradient(135deg, #f8fffe, #e8f5f3);
}

.zigzag-day.low {
    border-top-color: #ff6b6b;
    background: linear-gradient(135deg, #fff8f8, #f3e8e8);
}

.zigzag-day.maintenance {
    border-top-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff, #e8ecf3);
}

.day-name {
    font-weight: 600;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: #333;
    margin-bottom: 8px;
}

.day-calories {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.day-type {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zigzag-summary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: clamp(15px, 3vw, 20px);
    border-radius: 12px;
    text-align: center;
    margin-top: 20px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.zigzag-summary h4 {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    margin-bottom: 8px;
}

.zigzag-summary p {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Reset Button */
.reset-btn {
    display: block;
    margin: 0 auto;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: clamp(12px, 2.5vw, 15px) clamp(20px, 4vw, 30px);
    border-radius: 12px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    font-family: 'Poppins', sans-serif;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.reset-btn i {
    margin-right: 8px;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .calculator-form {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
    
    .calorie-summary {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .macros-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .recommendations-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .zigzag-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .input-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .input-group {
        min-width: 100%;
    }
    
    .unit-toggle {
        min-width: 70px;
    }
    
    .unit-btn {
        font-size: 0.8rem;
        padding: 10px 8px;
    }
    
    .input-with-unit {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }
    
    .input-with-unit input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .unit-toggle {
        align-self: flex-end;
        width: fit-content;
        max-width: 80px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .calculator-section,
    .results-section {
        padding: 15px;
        border-radius: 15px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .summary-card,
    .macro-card,
    .recommendation-card {
        padding: 20px;
    }
    
    .unit-toggle {
        min-width: 60px;
    }
    
    .unit-btn {
        font-size: 0.75rem;
        padding: 8px 6px;
    }
    
    .form-group input,
    .form-group select {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .input-group input {
        padding: 10px;
        font-size: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .calculate-btn,
    .reset-btn {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .zigzag-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 6px;
    }
    
    .zigzag-day {
        padding: 12px 8px;
    }
    
    .day-calories {
        font-size: 0.9rem;
    }
    
    .day-name {
        font-size: 0.75rem;
    }
    
    .day-type {
        font-size: 0.65rem;
    }
    
    .input-with-unit {
        gap: 6px;
        width: 100%;
    }
    
    .input-with-unit input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .unit-toggle {
        min-width: 55px;
        max-width: 70px;
    }
    
    .unit-btn {
        padding: 8px 4px;
        font-size: 0.7rem;
    }
}

@media (max-width: 360px) {
    .header h1 {
        font-size: 1.6rem;
    }
    
    .header p {
        font-size: 0.85rem;
    }
    
    .calculator-form {
        gap: 15px;
        max-width: 100%;
    }
    
    .calculator-section {
        padding: 10px;
        max-width: 100%;
    }
    
    .unit-toggle {
        min-width: 50px;
    }
    
    .unit-btn {
        font-size: 0.65rem;
        padding: 6px 3px;
    }
    
    .input-with-unit {
        gap: 4px;
    }
    
    .form-group input,
    .form-group select,
    .input-group input {
        padding: 10px;
        font-size: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .input-with-unit {
        width: 100%;
    }
    
    .input-with-unit input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
} 