/**
 * Theme Name: divi-child
 * Template:   Divi
 * Description: Custom child theme for Sugar Analyst
 */

/* ==========================================================================
   1. GLOBAL UI & DASHBOARD ELEMENTS
   ========================================================================== */

/* Modern Rounded Shadow Cards */
.sugar-tile {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 25px;
    border: 1px solid #f1f1f1;
    transition: box-shadow 0.3s ease;
}

.sugar-tile:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   2. HEADER & NAVIGATION
   ========================================================================== */

/* Inject Site Title (Stationary + Scrolling + Shadow) */
#main-header .logo_container a {
    display: flex !important;
    align-items: center !important;
    height: 100% !important; 
}

#main-header .logo_container a::after {
    content: 'Sugar Analyst' !important; 
    font-size: 36px !important;          
    font-weight: 700 !important;
    font-family: 'Playfair Display', serif;
    color: #ffffff !important;
    margin-left: 15px !important;        
    white-space: nowrap !important;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3) !important; 
}

#main-header .logo_container a img {
    width: auto !important;
}

/* Hamburger Menu Color */
.et_toggle_slide_menu:before, 
.et_toggle_slide_menu:after { 
    color: #7cda24 !important;  
}

/* ==========================================================================
   3. HERO SEARCH BAR
   ========================================================================== */

.sugar-search-wrapper {
    position: relative;
    max-width: 700px; /* Prevents it from stretching ridiculously wide on desktop */
    margin: 0 auto 3rem auto; /* Centers the bar horizontally and adds breathing room below */
    display: flex;
    align-items: center;
}

.sugar-search-icon {
    position: absolute;
    right: 25px; /* Pushed in slightly more to account for rounded corners */
    color: #666;
    display: flex; /* Helps center the icon perfectly */
    pointer-events: none;
}

/* Target the WordPress Dashicon specifically to make it bigger */
.sugar-search-icon .dashicons {
    font-size: 32px; 
    width: 32px;
    height: 32px;
}

.custom-sugar-tool .sugar-search-input {
    width: 100%;
    padding: 24px 24px 24px 75px; /* Massive padding, massive room for the big icon */
    font-size: 22px; /* Huge, highly readable text */
    border: 2px solid #e2e8f0; /* Thicker border */
    border-radius: 50px; /* Modern "pill" shape */
    background-color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08); /* Soft drop-shadow makes it pop off the screen */
    transition: all 0.3s ease;
}

/* Focus State */
.custom-sugar-tool .sugar-search-input:focus {
    outline: none;
    border-color: #d97706; /* Sugar Analyst Orange */
    box-shadow: 0 10px 30px rgba(217, 119, 6, 0.15); /* Orange tinted shadow */
}

/* Placeholder Text */
.custom-sugar-tool .sugar-search-input::placeholder {
    color: #a0aec0;
    font-size: 20px;
}

/* ==========================================================================
   4. DATA TABLES (SUGAR DICTIONARY & ENZYMES)
   ========================================================================== */

.custom-sugar-tool {
    width: 100%;
    margin-bottom: 2rem;
}

/* Responsive Table Wrapper */
.sugar-table-responsive,
.enzyme-table-wrapper {
    overflow-x: auto; /* Makes it scrollable on mobile */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-radius: 8px;
}

/* Base Table Styles */
.sugar-data-table,
.enzyme-comparison-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    font-size: 15px;
}

/* Enzyme Specific Width & Alignment */
.enzyme-comparison-table {
    min-width: 900px; /* Forces mobile to scroll rather than squash text */
    text-align: center;
}

/* Table Headers & Cells */
.sugar-data-table th, .sugar-data-table td,
.enzyme-comparison-table th, .enzyme-comparison-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.enzyme-comparison-table th, .enzyme-comparison-table td {
    border: 1px solid #e2e8f0; /* Replaces Bootstrap table-bordered */
}

.sugar-data-table th,
.enzyme-comparison-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.enzyme-comparison-table th {
    font-weight: 700;
    vertical-align: top;
}

.enzyme-comparison-table td.text-start {
    text-align: left;
}

.enzyme-function-row {
    background-color: #edf2f7 !important;
    font-weight: 600;
    font-size: 13px;
    color: #4a5568;
}

/* Force Table Stripes (Replaces Bootstrap) */
.custom-sugar-tool table.sugar-data-table tbody tr:nth-child(odd) td,
.custom-sugar-tool table.sugar-data-table tbody tr:nth-child(odd) th,
.enzyme-comparison-table tbody tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

/* Force Table Hover Effect */
.custom-sugar-tool table.sugar-data-table tbody tr:hover td,
.custom-sugar-tool table.sugar-data-table tbody tr:hover th,
.enzyme-comparison-table tbody tr:hover td {
    background-color: rgba(0, 0, 0, 0.06) !important;
}

.enzyme-comparison-table caption {
    caption-side: bottom;
    padding: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Sources List */
.sugar-sources p { margin-bottom: 0.5rem; }
.sugar-sources ul {
    list-style-type: disc;
    margin-left: 20px;
    font-size: 14px;
}

/* Mobile Sticky First Column (Enzymes) */
@media (max-width: 768px) {
    .enzyme-comparison-table th:first-child,
    .enzyme-comparison-table td:first-child {
        position: sticky;
        left: 0;
        background-color: #fff !important; 
        z-index: 2;
        box-shadow: 2px 0 5px rgba(0,0,0,0.08); 
    }
    .enzyme-comparison-table th:first-child {
        z-index: 3; 
        background-color: #f8f9fa !important;
    }
}

/* ==========================================================================
   5. WOOCOMMERCE: MY ACCOUNT PORTAL
   ========================================================================== */

/* Modern WooCommerce My Account Menu - Vertical Stack */
.woocommerce-MyAccount-navigation ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 30px 0 !important;
    display: flex;
    flex-direction: column; /* Forces them to stack vertically */
    gap: 16px; /* Space between the buttons */
}

.woocommerce-MyAccount-navigation ul li {
    margin: 0 !important;
    list-style-type: none !important;
    width: 100%; /* Ensures the list item fills the column */
}

/* The Button Styling */
.woocommerce-MyAccount-navigation ul li a {
    background: #f8fafc;
    color: #475569;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    display: block; /* Makes the entire width of the button clickable */
}

/* Hover & Active States */
.woocommerce-MyAccount-navigation ul li a:hover,
.woocommerce-MyAccount-navigation ul li.is-active a {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

/* Give the main content some breathing room */
.woocommerce-MyAccount-content {
    background: #ffffff;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Floating Save Button for Account Settings */
.woocommerce-EditAccountForm button[name="save_account_details"] {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 9999;
    background-color: #0f172a !important; /* Primary Deep Slate */
    color: #ffffff !important; /* Pure White Text */
    border: none !important; 
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.4) !important; 
    border-radius: 50px !important; 
    padding: 16px 32px !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
    cursor: pointer;
}

.woocommerce-EditAccountForm button[name="save_account_details"]:hover {
    transform: translateY(-3px);
    background-color: #1e293b !important; 
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.6) !important;
}

@media (max-width: 768px) {
    .woocommerce-EditAccountForm button[name="save_account_details"] {
        bottom: 20px;
        right: 20px;
        left: 20px;
        width: calc(100% - 40px);
        text-align: center;
        border-radius: 12px !important;
    }
}

/* ==========================================================================
   6. INGREDIENT PAGES & SAFETY BADGES
   ========================================================================== */

/* The Safety Badge Styling */
.sa-badge {
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-block;
}
.badge-safe { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-caution { background: #fffbeb; color: #92400e; border: 1px solid #fef3c7; }
.badge-variable { background: #fff7ed; color: #9a3412; border: 1px solid #ffedd5; }
.badge-avoid { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
 
/* Ingredient Page Warmth */
.single-ingredient {
    background-color: #fffaf5 !important; /* Soft Cream/Peach background */
}

/* The Invite Overlay */
.sa-community-invite-overlay {
    background: #fffcf9;
    border: 2px solid #fce8d5; /* Warm amber border */
    border-radius: 24px;
    padding: 60px 40px;
    text-align: center;
    max-width: 800px;
    margin: 40px auto;
    box-shadow: 0 20px 40px rgba(210, 120, 50, 0.05);
}

.sa-invite-icon {
    color: #d97706; /* Warm Orange/Amber */
    margin-bottom: 20px;
}

.sa-community-invite-overlay h3 {
    font-family: inherit;
    font-weight: 800;
    color: #451a03; /* Deep earthy brown instead of cold black */
    font-size: 1.8rem;
}

.sa-community-invite-overlay p {
    color: #78350f;
    font-size: 1.15rem;
    line-height: 1.6;
}

/* Collaborative Buttons */
.sa-invite-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.sa-invite-buttons .btn-main {
    background: #d97706; /* Warm Amber */
    color: #fff;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
}

.sa-invite-buttons .btn-sub {
    background: transparent;
    color: #d97706;
    border: 2px solid #d97706;
    padding: 14px 30px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
}

.sa-invite-buttons .btn-main:hover {
    background: #b45309;
    transform: translateY(-2px);
}

/* Hide the cold default comments when not logged in */
.single-ingredient.logged-out #comment-section,
.single-ingredient.logged-out .et_pb_comments_0 {
    display: none !important;
}

/* ==========================================================================
   7. WIKI TALK AREA: MASTER STYLING
   ========================================================================== */

/* The Main Container */
.sa-wiki-talk-area {
    display: flex;
    flex-direction: column; 
    gap: 40px; 
    background: #fffcf7; 
    padding: 40px;
    border-radius: 24px;
    border: 1px solid #e9e0d2;
    margin-top: 40px;
}

/* THE FORM (Add to Knowledge) */
#respond {
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    border: 1px dashed #dcd3c9;
    box-shadow: 0 4px 15px rgba(139, 94, 60, 0.04);
    margin-bottom: 0 !important;
}

#respond .comment-reply-title {
    font-family: inherit;
    font-weight: 800;
    color: #451a03;
    font-size: 1.4rem;
    margin-bottom: 15px;
    display: block;
}

#respond .comment-form-comment label {
    display: block;
    font-weight: 600;
    color: #78350f;
    margin-bottom: 8px;
}

#respond textarea {
    width: