/* 
 * Upgraded Scope-isolated CSS Stylesheet for Shopify Profit Margin & Fee Engine
 * Matches ToolForYou.in light-theme branding system
 * Optimized for modern SaaS dashboards and print-to-PDF reports
 */

.shopify-calc-container {
    --shopify-green: #96bf48;
    --shopify-green-dark: #5c8f22;
    --shopify-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --light-accent: rgba(79, 70, 229, 0.06);
    --border-accent: rgba(79, 70, 229, 0.15);
}

/* Searchable Country Selector Popover Components */
.searchable-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-search-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23475569' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 15px;
    padding-right: 36px !important;
    font-weight: 600;
}

.dropdown-results-popover {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1005;
    margin-top: 4px;
    display: none;
}

.dropdown-results-popover.show {
    display: block;
    animation: dropdownFadeIn 0.15s cubic-bezier(0, 0, 0.2, 1);
}

.dropdown-option-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    transition: var(--transition-base);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-option-item:last-child {
    border-bottom: none;
}

.dropdown-option-item:hover, .dropdown-option-item.highlighted {
    background-color: var(--light-accent);
    color: var(--primary);
}

.dropdown-option-item .badge {
    font-size: 10px;
    font-weight: 600;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Monthly / Yearly Billing Toggle Component */
.billing-toggle-wrapper {
    display: inline-flex;
    background-color: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.billing-toggle-btn {
    border: none;
    background: none;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-base);
    outline: none !important;
}

.billing-toggle-btn.active {
    background-color: var(--primary);
    color: #ffffff !important;
    box-shadow: var(--shadow-sm);
}

/* Prominent Expected Payout Summary Card */
.shopify-payout-card {
    background: var(--shopify-gradient);
    color: #ffffff;
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.shopify-payout-card::before {
    content: '';
    position: absolute;
    bottom: -15px;
    right: -15px;
    width: 120px;
    height: 120px;
    background-image: url("../assets/shopify_logo.webp");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.06; /* Low opacity watermark */
    filter: blur(0.5px); /* Premium SaaS blur */
    pointer-events: none;
}

/* Scoped Profit & Loss Status Elements */
.shopify-text-profit {
    color: #0d9488 !important; /* Teal Profit */
    font-weight: 700;
}

.shopify-text-loss {
    color: #e11d48 !important; /* Rose Red Loss */
    font-weight: 700;
}

.shopify-bg-profit {
    background-color: rgba(13, 148, 136, 0.06) !important;
    border: 1px solid rgba(13, 148, 136, 0.15) !important;
}

.shopify-bg-loss {
    background-color: rgba(225, 29, 72, 0.06) !important;
    border: 1px solid rgba(225, 29, 72, 0.15) !important;
}

/* Interactive Charts Container Styling */
.shopify-charts-wrapper {
    position: relative;
    width: 100%;
    max-height: 250px;
}

/* Solver Tabs Sub-navigation */
.shopify-nav-tabs-custom .nav-link {
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    font-size: 14px;
    transition: var(--transition-base);
}

.shopify-nav-tabs-custom .nav-link:hover {
    color: var(--primary);
    border-bottom-color: var(--border-color);
}

.shopify-nav-tabs-custom .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
    font-weight: 600;
}

/* Sticky Results Column for Desktop Viewports */
.shopify-sticky-results {
    position: sticky;
    top: 90px;
}

/* Mobile Action Button Trigger */
.shopify-mobile-calc-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 998;
    border-radius: 0;
    padding: 14px;
    display: none;
    background: linear-gradient(135deg, #95BF47 0%, #7AB55C 50%, #5E8E3E 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 -4px 20px rgba(149, 191, 71, 0.35) !important;
    transition: var(--transition-base);
}

.shopify-mobile-calc-btn:hover, .shopify-mobile-calc-btn:focus {
    background: linear-gradient(135deg, #7AB55C 0%, #5E8E3E 100%) !important;
    box-shadow: 0 -4px 25px rgba(94, 142, 62, 0.45) !important;
    outline: none;
}

.shopify-mobile-calc-btn:active {
    transform: scale(0.98);
}

/* Font helpers */
.shopify-x-small {
    font-size: 0.78rem;
}

.shopify-small-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Country Currency Indicator Tag inside Inputs */
.currency-addon {
    font-weight: 700 !important;
    background-color: #f1f5f9 !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
    min-width: 44px;
    text-align: center;
    justify-content: center;
}

/* Scenario comparisons table */
.shopify-table-comparison th, .shopify-table-comparison td {
    font-size: 13px;
    text-align: center;
    vertical-align: middle;
}

/* Metric breakdowns visual grid cards */
.metric-breakdown-card {
    border-radius: 8px;
    padding: 10px 14px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
}

.metric-breakdown-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.metric-breakdown-val {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Advanced Forecast Projection Cards */
.projection-card {
    border-radius: 8px;
    padding: 14px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
}

.projection-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.projection-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.projection-row:last-child {
    margin-bottom: 0;
}

.projection-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.projection-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Smart Recommendation Engine Custom Alerts styling */
.diagnostic-notice-item {
    font-size: 13px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.diagnostic-notice-item:last-child {
    margin-bottom: 0;
}

.diagnostic-icon {
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

.diagnostic-text {
    flex-grow: 1;
}

/* Color schemes for notices */
.diagnostic-healthy {
    background-color: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #065f46;
}

.diagnostic-warning {
    background-color: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    color: #92400e;
}

.diagnostic-critical {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

/* Trust section badges styling */
.trust-badge-card {
    border-radius: 8px;
    padding: 12px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.trust-badge-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.trust-badge-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* ==========================================
 * HIGHLY OPTIMIZED PRINT MEDIA STYLESHEET
 * Generates beautiful 1-page financial PDF reports
 * ========================================== */
@media print {
    /* Hide all workspace visual chrome wrappers */
    nav, .site-footer, .social-sidebar, form, .shopify-mobile-calc-btn, 
    #solverTabs, .tab-content, .btn, .alert, .TrustSectionTitle, .trust-badge-card,
    .FAQPage, section.text-muted, details, #solverTabContent, .projection-card .projection-title {
        display: none !important;
    }

    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        font-size: 12px !important;
        font-family: 'Outfit', sans-serif !important;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    main {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Keep calculations pane expanded in full width printable columns */
    .col-lg-5, .col-lg-7 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .shopify-sticky-results {
        position: static !important;
    }

    /* Print header layout */
    .shopify-payout-card {
        background: #ffffff !important;
        color: #000000 !important;
        border: 2px solid #000000 !important;
        box-shadow: none !important;
        padding: 15px !important;
        margin-bottom: 20px !important;
    }

    .shopify-payout-card #highlightPayout,
    .shopify-payout-card #payoutSummaryHeader {
        color: #000000 !important;
    }

    .shopify-payout-card::before {
        display: none !important;
    }

    /* Scopes card visual borders */
    .card {
        border: 1px solid #000000 !important;
        box-shadow: none !important;
        background: #ffffff !important;
        margin-bottom: 20px !important;
    }

    .card-header {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        border-bottom: 1px solid #000000 !important;
        font-weight: 700 !important;
    }

    /* Print scenario matrices and projection grids */
    .row.g-2 {
        display: flex !important;
        flex-direction: row !important;
        gap: 15px !important;
    }

    .col-md-6 {
        flex: 0 0 48% !important;
        max-width: 48% !important;
    }

    .projection-card {
        border: 1px solid #000000 !important;
        background-color: #ffffff !important;
        padding: 10px !important;
    }

    /* Recommendations diagnostic notices */
    .diagnostic-notice-item {
        border: 1px solid #000000 !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        padding: 6px 10px !important;
    }

    /* Tables grids */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    table th, table td {
        border: 1px solid #000000 !important;
        padding: 6px !important;
        font-size: 11px !important;
    }

    /* Page margins configuration */
    @page {
        size: A4 portrait;
        margin: 1.5cm;
    }
}

/* Mobile layout tuning */
@media (max-width: 991px) {
    .shopify-sticky-results {
        position: static;
    }
    .shopify-mobile-calc-btn {
        display: block;
    }
    body {
        padding-bottom: 60px; /* Offset for sticky bottom button */
    }
}
