/* ===================================================================
   COMPONENTS.CSS - Bake App
   - Contains styles for all reusable UI components like tables,
     cards, status indicators, and content boxes.
   - Designed to work with core.css, navigation.css, etc.
=================================================================== */

/* ===================================
   1. MAIN RECIPE CONTAINER
=================================== */
.recipe-container {
    background-color: rgba(0, 43, 54, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari compatibility */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 2rem;
    color: #93a1a1;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.recipe-title {
    color: #2d3748;
    font-weight: 700;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recipe-title:hover {
    color: #667eea;
    transform: scale(1.02);
}

/* ===================================
   2. INGREDIENTS TABLE
=================================== */
.ingredients-table {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.table {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
    border: none;
    text-align: center; /* Default alignment for headers */
}

.table th:first-child {
    text-align: left; /* Keep ingredient name header left-aligned */
}

.table td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-color: #e9ecef;
    text-align: center; /* Default alignment for data cells */
}

.table td:first-child {
    text-align: left; /* Keep ingredient names left-aligned */
}

.table-hover tbody tr:hover {
    background: rgba(102, 126, 234, 0.08);
}

.table tbody tr:last-child {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    border-top: 2px solid #667eea;
}

.form-control-weight {
    font-size: 1rem;
    min-height: 44px;
    font-weight: 500;
}

/* ===================================
   3. VISUAL RECIPE CHOOSER
=================================== */
/* The main container that fills the modal body */
.visual-chooser-container {
    display: flex;
    align-items: center;    /* Vertically centers the cards */
    gap: 3vw;
    padding: 0 3vw;       /* Horizontal padding only */
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
}

/* The individual recipe card, sized for the modal */
.visual-recipe-card {
    flex: 0 0 80%;
    height: 90%;            /* Relative height to fit on any screen */
    max-width: 400px;       /* Prevents cards from becoming too wide */
    max-height: 700px;      /* Prevents cards from becoming too tall */
    scroll-snap-align: center;
    position: relative;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: transform 0.15s ease-out, border-color 0.3s ease-in-out;
}

/* --- Styles for the Card's Content (Previously Missing) --- */

.visual-recipe-card a {
    display: block;
    height: 100%;
    text-decoration: none;
    color: white;
}

/* Press down effect on click/tap */
.visual-recipe-card a:hover,
.visual-recipe-card a:focus,
.visual-recipe-card a:active {
    transform: scale(0.98);
}

.visual-recipe-card .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

/* Image zoom effect on hover */
.visual-recipe-card a:hover .card-img-top {
    transform: scale(1.05);
}

.visual-recipe-card .card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0));
    height: 220px;
    overflow: hidden;
}

/* Scrolling text animation logic */
.visual-recipe-card .card-text-scroller {
    animation: scrollText 15s linear infinite;
    animation-play-state: paused; /* Controlled by JS */
}

.visual-recipe-card.in-viewport .card-text-scroller {
    animation-play-state: running; /* Run only when visible */
}

.visual-recipe-card:hover .card-text-scroller {
    animation-play-state: paused; /* Pause on hover for reading */
}

/* ===================================
   4. CENTRALIZED AVAILABILITY INDICATORS
=================================== */

/* Style for Dropdown Menu Items */
.recipe-available { border-left: 4px solid #28a745 !important; }
.recipe-partial { border-left: 4px solid #ffc107 !important; }
.recipe-unavailable { border-left: 4px solid #dc3545 !important; opacity: 0.7; }

/* Style for Visual Recipe Cards */
.card-available { border-top: 5px solid #28a745; }
.card-partial { border-top: 5px solid #ffc107; }
.card-unavailable { border-top: 5px solid #dc3545; opacity: 0.85; }

/* Style for Ingredient Table Rows */
.ingredient-available { background-color: rgba(40, 167, 69, 0.1) !important; border-left: 4px solid #28a745; }
.ingredient-insufficient { background-color: rgba(255, 193, 7, 0.1) !important; border-left: 4px solid #ffc107; }
.ingredient-unavailable { background-color: rgba(220, 53, 69, 0.1) !important; border-left: 4px solid #dc3545; }

/* Icon inside the table cell */
.ingredient-status-icon {
    font-size: 1.1em;
    margin-left: 8px;
}

/* ===================================
   5. PREPARATION INSTRUCTIONS BOX
=================================== */
/* Custom preparation instructions container */
.prep-instructions-container {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #94a3b8;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 1rem 0;
}

/* Header styling */
.prep-instructions-header {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 0;
}

/* Content area refinements */
.prep-instructions-container .preparation-content {
    padding: 0.25rem 0;
    margin: 0;
    background: transparent;
    border: none;
    line-height: 1.6;
    color: #374151;
}

.preparation-content {
    line-height: 1.8;
    font-size: 0.95rem;
    color: #000000;
    background: #fffef7;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    white-space: pre-wrap; /* Respects newlines */
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    text-align: justify;
    font-weight: 400;
}

.preparation-content strong {
    color: #333333;
    font-size: 1.1rem;
    display: block;
    margin: 1rem 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preparation-content::-webkit-scrollbar { width: 8px; }
.preparation-content::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); }
.preparation-content::-webkit-scrollbar-thumb { background: rgba(102, 126, 234, 0.3); border-radius: 4px; }
.preparation-content::-webkit-scrollbar-thumb:hover { background: rgba(102, 126, 234, 0.5); }


/* ===================================
   6. FLOATING ACTION BUTTONS (Z-INDEX)
=================================== */
.position-fixed[ng-if="loggedIn"] {
    z-index: 9999 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.position-fixed[style*="bottom: 140px"] { z-index: 9997 !important; } /* Shopping Lists */
.position-fixed[style*="bottom: 80px"] { z-index: 9998 !important; }  /* User Ingredients */
.position-fixed[style*="bottom: 20px"] { z-index: 9999 !important; }  /* Family Management */

.position-fixed .btn {
    z-index: 10000 !important;
}
