/* Foodshare Branding Colors and Styles */
:root {
    --foodshare-primary: #2E7D32;      /* Green primary */
    --foodshare-secondary: #4CAF50;     /* Light green */
    --foodshare-accent: #81C784;        /* Lighter green accent */
    --foodshare-dark: #1B5E20;          /* Dark green */
    --foodshare-orange: #FF9800;        /* Orange accent */
    --foodshare-light-bg: #F1F8E9;      /* Very light green background */
    --foodshare-border: #C8E6C9;        /* Light green border */
    --foodshare-text: #2E2E2E;          /* Dark text */
    --foodshare-text-light: #666666;    /* Light text */
    --foodshare-error: #D32F2F;         /* Error red */
    --foodshare-success: #388E3C;       /* Success green */
    --foodshare-warning: #F57C00;       /* Warning orange */
}

#foodshare-form-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
    border: 2px solid var(--foodshare-border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#foodshare-form-container h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: var(--foodshare-primary);
    border-bottom: 3px solid var(--foodshare-primary);
    padding-bottom: 15px;
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    position: relative;
}

#foodshare-form-container h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--foodshare-orange);
    border-radius: 2px;
}

#foodshare-form-container h3 {
    color: var(--foodshare-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 25px 0 15px 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--foodshare-border);
}

.foodshare-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: end;
}

.foodshare-form-group {
    flex: 1;
}

.foodshare-form-group.full-width {
    flex: 100%;
}

.foodshare-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--foodshare-text);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.foodshare-form-group input,
.foodshare-form-group select,
.foodshare-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--foodshare-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--foodshare-text);
    background: #ffffff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.foodshare-form-group input:focus,
.foodshare-form-group select:focus,
.foodshare-form-group textarea:focus {
    outline: none;
    border-color: var(--foodshare-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    background: var(--foodshare-light-bg);
}

.foodshare-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.foodshare-form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E7D32' 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 12px center;
    background-size: 20px;
    padding-right: 45px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Specific styling for category dropdowns */
.category-input {
    font-weight: 500;
}

.category-input:focus {
    outline: none;
    border-color: var(--foodshare-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    background: var(--foodshare-light-bg);
}

/* Update the complete/incomplete row styling for selects */
.food-item-row.complete-row .category-input,
.food-item-row.complete-row .weight-input {
    border-left-color: var(--foodshare-success);
    border-left-width: 4px;
}

.food-item-row.incomplete-row .category-input,
.food-item-row.incomplete-row .weight-input {
    border-left-color: #ff9800;
    border-left-width: 4px;
}

/* Remove the scale input container styles and add these new ones */

/* Scale Instructions */
.scale-instructions {
    background: linear-gradient(135deg, var(--foodshare-light-bg) 0%, #ffffff 100%);
    border: 2px solid var(--foodshare-secondary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.scale-instructions p {
    margin: 0;
    color: var(--foodshare-primary);
    font-weight: 500;
}

/* Enhanced weight input styling */
.weight-input.scale-enabled {
    background: linear-gradient(135deg, #ffffff 0%, var(--foodshare-light-bg) 100%);
    border: 2px solid var(--foodshare-secondary);
    font-weight: 600;
    color: var(--foodshare-primary);
}

.weight-input.scale-enabled:focus {
    background: var(--foodshare-light-bg);
    border-color: var(--foodshare-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.weight-input.scale-enabled::placeholder {
    color: var(--foodshare-text-light);
    font-style: italic;
}

/* Food Items Container */
#food-items-container {
    border: 2px solid var(--foodshare-border);
    border-radius: 12px;
    padding: 20px;
    margin: 25px 0;
    background: linear-gradient(135deg, #ffffff 0%, var(--foodshare-light-bg) 100%);
    position: relative;
}

#food-items-container::before {
    content: '🥬 Food Items';
    position: absolute;
    top: -15px;
    left: 20px;
    background: #ffffff;
    padding: 0 15px;
    font-weight: 600;
    color: var(--foodshare-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.food-item-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid var(--foodshare-border);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.food-item-row:hover {
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
    border-color: var(--foodshare-secondary);
}

.food-item-row:last-child {
    margin-bottom: 0;
    border: 2px dashed var(--foodshare-secondary);
    background: var(--foodshare-light-bg);
}

.food-item-row .foodshare-form-group {
    flex: 1;
}

.food-item-row .foodshare-form-group label {
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--foodshare-text-light);
}

.food-item-row input {
    padding: 10px 12px;
    font-size: 14px;
}

/* Total Weight Display */
#total-weight-container {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, var(--foodshare-primary) 0%, var(--foodshare-secondary) 100%);
    color: #ffffff;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
    position: relative;
    overflow: hidden;
}

#total-weight-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    /* background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
     transform: rotate(45deg);
     animation: shine 3s infinite; */
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
    100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}

#total-weight {
    color: var(--foodshare-orange);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Form Actions */
.form-actions {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid var(--foodshare-border);
    text-align: center;
}

.button-primary {
    background: linear-gradient(135deg, var(--foodshare-primary) 0%, var(--foodshare-secondary) 100%);
    color: #ffffff;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
    position: relative;
    overflow: hidden;
}

.button-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.button-primary:hover {
    background: linear-gradient(135deg, var(--foodshare-dark) 0%, var(--foodshare-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.4);
}

.button-primary:hover::before {
    left: 100%;
}

.button-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.button-primary:disabled {
    background: var(--foodshare-text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-primary:disabled::before {
    display: none;
}

/* Messages */
#form-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    display: none;
    font-weight: 500;
    text-align: center;
    position: relative;
}

#form-message.success {
    background: linear-gradient(135deg, var(--foodshare-success) 0%, var(--foodshare-secondary) 100%);
    color: #ffffff;
    border: 1px solid var(--foodshare-success);
}

#form-message.error {
    background: linear-gradient(135deg, var(--foodshare-error) 0%, #E57373 100%);
    color: #ffffff;
    border: 1px solid var(--foodshare-error);
}

#form-message.warning {
    background: linear-gradient(135deg, var(--foodshare-warning) 0%, var(--foodshare-orange) 100%);
    color: #ffffff;
    border: 1px solid var(--foodshare-warning);
}

/* Loading Animation */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    #foodshare-form-container {
        margin: 10px;
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .food-item-row {
        flex-direction: column;
        gap: 15px;
    }
    
    #foodshare-form-container h2 {
        font-size: 24px;
    }
    
    #total-weight-container {
        font-size: 20px;
        padding: 15px;
    }
    
    .button-primary {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    #scale_input {
        font-size: 16px;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    #foodshare-form-container {
        padding: 15px;
    }
    
    #foodshare-form-container h2 {
        font-size: 20px;
    }
    
    .foodshare-form-group input,
    .foodshare-form-group select,
    .foodshare-form-group textarea {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    #total-weight-container {
        font-size: 18px;
        padding: 12px;
    }
    
    .button-primary {
        width: 100%;
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    #foodshare-form-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .button-primary,
    #scale-input-container {
        display: none;
    }
    
    #total-weight-container {
        background: #f0f0f0 !important;
        color: #000 !important;
        box-shadow: none;
    }
}

/* Accessibility Improvements */
.foodshare-form-group input:focus,
.foodshare-form-group select:focus,
.foodshare-form-group textarea:focus {
    outline: 2px solid var(--foodshare-primary);
    outline-offset: 2px;
}

.button-primary:focus {
    outline: 2px solid var(--foodshare-orange);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --foodshare-primary: #1B5E20;
        --foodshare-secondary: #2E7D32;
        --foodshare-border: #666666;
    }
    
    .foodshare-form-group input,
    .foodshare-form-group select,
    .foodshare-form-group textarea {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* Row state indicators */
.food-item-row.complete-row {
    background: linear-gradient(135deg, #e8f5e8 0%, #ffffff 100%);
    border-left: 4px solid var(--foodshare-success);
    padding-left: 16px;
    margin-left: -20px;
    border-radius: 4px;
}

.food-item-row.incomplete-row {
    background: linear-gradient(135deg, #fff3e0 0%, #ffffff 100%);
    border-left: 4px solid #ff9800;
    padding-left: 16px;
    margin-left: -20px;
    border-radius: 4px;
}

.food-item-row.complete-row .category-input,
.food-item-row.complete-row .weight-input {
    border-color: var(--foodshare-success);
}

.food-item-row.incomplete-row .category-input,
.food-item-row.incomplete-row .weight-input {
    border-color: #ff9800;
}

/* Save button states */
#save-button {
    transition: all 0.3s ease;
}

#save-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
/* Required field indicators - only for header fields */
#date_received, #time_received, #source, #collection, #program {
    border-left: 3px solid var(--foodshare-primary);
}

/* Optional field styling */
.category-input, .weight-input, #notes, #origin {
    border-left: 3px solid #e0e0e0;
}

/* Update the complete/incomplete row styling */
.food-item-row.complete-row .category-input,
.food-item-row.complete-row .weight-input {
    border-left-color: var(--foodshare-success);
    border-left-width: 4px;
}

.food-item-row.incomplete-row .category-input,
.food-item-row.incomplete-row .weight-input {
    border-left-color: #ff9800;
    border-left-width: 4px;
}

   /* Clear button styles */
   .input-with-clear {
       position: relative;
       display: inline-block;
       width: 100%;
   }
   
   .input-with-clear input {
       padding-right: 40px !important;
   }
   
   .clear-input-btn {
       position: absolute;
       right: 8px;
       top: 50%;
       transform: translateY(-50%);
       width: 24px;
       height: 24px;
       border: none;
       background: #999;
       color: white;
       border-radius: 3px;
       cursor: pointer;
       font-size: 18px;
       line-height: 1;
       padding: 0;
       display: none;
       transition: all 0.2s ease;
       z-index: 10;
   }
   
   .clear-input-btn:hover {
       background: #666;
   }
   
   .clear-input-btn:active {
       background: #444;
   }
/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-spinner-container {
    background: white;
    padding: 40px 60px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--foodshare-primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--foodshare-primary);
}

/* Prevent scrolling when overlay is active */
body.loading-active {
    overflow: hidden;
}
