/**
 * LuvMyRecipe Pantry & Fridge Styles
 */
#lmr-pantry-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #eaeaea;
    border-radius: 8px;
}

.lmr-pantry-intro {
    text-align: center;
    margin-bottom: 20px;
}

.lmr-input-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.lmr-form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.lmr-btn-group {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap; /* Added so buttons stack cleanly on small mobile screens */
}

/* Styling for the new lenient submit button to distinguish it */
#lmr-pantry-submit-add-btn {
    background-color: #d69e2e;
}

#lmr-pantry-submit-add-btn:hover {
    background-color: #b7791f;
}

.lmr-primary-btn {
    background-color: #ff6347; /* LMR Tomato */
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lmr-primary-btn:hover {
    background-color: #e5533c;
}

.lmr-primary-btn:disabled {
    background-color: #ffaa99;
    cursor: not-allowed;
}

.lmr-secondary-btn {
    background-color: #8b4513; /* LMR SaddleBrown */
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lmr-secondary-btn:hover {
    background-color: #70360e;
}

/* Override the default secondary button colors specifically for the Start Over button */
#lmr-pantry-reset-btn {
    background-color: #ff6347; 
}

#lmr-pantry-reset-btn:hover {
    background-color: #ff9684; 
}

#lmr-pantry-loading {
    text-align: center;
    margin-top: 20px;
    font-size: 18px;
    color: #ff6347;
    font-weight: bold;
}

/* Results Display */
.lmr-recipe-card {
    position: relative; /* Added so the absolute print icon stays inside the card */
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* New styling for the image-based print icon */
.lmr-print-recipe-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px; /* Scales down the 256px image to a clean icon size */
    height: auto;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

/* Add a nice hover effect so it feels interactive */
.lmr-print-recipe-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.lmr-recipe-card h2 {
    color: #8b4513;
    margin-top: 0;
    border-bottom: 2px solid #ff6347;
    padding-bottom: 10px;
    padding-right: 40px; /* Leaves room so a long title won't overlap the print icon */
}

.lmr-recipe-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    background: #fff8dc;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.lmr-ingredients-list {
    margin-bottom: 20px;
    padding-left: 20px;
}

.lmr-ingredients-list li {
    margin-bottom: 6px;
}

.lmr-instructions-list {
    padding-left: 20px;
}

.lmr-instructions-list li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.lmr-recipe-notes {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-left: 4px solid #8b4513;
    font-style: italic;
}

.lmr-error {
    color: #d63638;
    background: #fcf0f1;
    padding: 12px;
    border: 1px solid #f8c1c2;
    border-radius: 4px;
    text-align: center;
}

/* ==========================================================================
   DRAWER UI STYLES
   ========================================================================== */

/* The Drawer Toggle Button (Positions it neatly above the main box) */
#lmr-pantry-wrapper {
    position: relative; 
}

/* The Drawer Toggle Button (Vertical Side-Tab) */
#lmr-drawer-toggle {
    position: fixed !important; 
    top: 50% !important; 
    /* Hide off-screen to the right by default instead of using display: none */
    right: -100px !important; 
    transform: translateY(-50%) !important;
    padding: 16px 8px !important;
    border-radius: 8px 0 0 8px !important; 
    z-index: 10000 !important; 
    box-shadow: -4px 0 10px rgba(0,0,0,0.15) !important;
    writing-mode: vertical-rl !important;
    text-orientation: mixed !important;
    white-space: nowrap;
    transition: right 0.3s ease, background-color 0.2s ease !important;
    cursor: pointer;
    margin: 0 !important;
    display: inline-flex !important; /* Force it to stay rendered in the DOM */
    background-color: #ff6347 !important; /* Override default secondary class background */
}

/* Prevent the handle from inheriting the brown hover color from the secondary class */
#lmr-drawer-toggle:hover {
    background-color: #ff6347 !important; 
}

/* State 1: Has recipes (peeking out) */
#lmr-drawer-toggle.has-recipes {
    right: 0 !important;
}

/* State 2: Drawer is open (pushed out) */
#lmr-drawer-toggle.has-recipes.drawer-is-open {
    right: 350px !important; 
}

@media (max-width: 388px) { 
    #lmr-drawer-toggle.has-recipes.drawer-is-open {
        right: 90% !important;
    }
}

/* Adjust the counter bubble */
#lmr-drawer-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff9684; /* Set to the new lighter orange/pink */
    border-radius: 50%;
    width: 22px;
    height: 22px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    writing-mode: horizontal-tb;
    transform: rotate(90deg);
    transition: background-color 0.2s ease; /* Smooth fade for hover effect */
}

/* Swap the bubble background color when the handle itself is hovered */
#lmr-drawer-toggle:hover #lmr-drawer-count {
    background: #ff6347; 
}

/* Adjust the counter bubble */
#lmr-drawer-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    writing-mode: horizontal-tb;
    transform: rotate(90deg);
}

/* The Drawer Itself */
.lmr-drawer {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden off-screen by default */
    width: 350px;
    max-width: 90%;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    z-index: 9999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lmr-drawer.open {
    right: 0;
}

.lmr-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #ff6347; /* LMR Tomato */
    color: #fff;
}

.lmr-drawer-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
}

#lmr-drawer-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

#lmr-drawer-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fdfdfd;
}

.lmr-drawer-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.lmr-drawer-item:hover {
    background: #fff8dc;
    border-color: #ff6347;
    transform: translateY(-2px);
}

/* The Dark Background Overlay */
#lmr-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: none; /* Hidden by default */
}

/* Drawer Save Button Styles */
.lmr-drawer-item-wrapper {
    display: flex;
    align-items: stretch;
    margin-bottom: 10px;
    gap: 8px;
}

.lmr-drawer-item {
    flex-grow: 1;
    padding: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-bottom: 0; /* Reset from previous version */
}

.lmr-drawer-save-btn {
    background-color: #8b4513;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.lmr-drawer-save-btn:hover:not(:disabled) {
    background-color: #70360e;
}

.lmr-drawer-save-btn.saved {
    background-color: #4caf50;
    cursor: default;
}

.lmr-drawer-save-btn:disabled:not(.saved) {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ==========================================================================
   PRINT STYLES FOR RECIPE CARD
   ========================================================================== */
@media print {
    /* Hide everything on the page including app nav and forms */
    body * {
        visibility: hidden;
    }
    
    /* Un-hide only the results container and its internal elements */
    #lmr-pantry-results, 
    #lmr-pantry-results * {
        visibility: visible;
    }
    
    /* Reposition the recipe card to the top-left of the printed paper */
    #lmr-pantry-results {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* Hide the print button itself so it doesn't waste ink */
    .lmr-print-recipe-btn {
        display: none !important;
    }
    
    /* Remove the card border and shadow for a cleaner document */
    .lmr-recipe-card {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    /* Ensure the drawer toggle handle doesn't peek out on the printout */
    #lmr-drawer-toggle {
        display: none !important;
    }
}