/* =============================================
   Medicine Reconciliation Widget — Green/White Color Scheme
   Matches the Meal Agent & evaluatemymeds.com design
   ============================================= */

/* Overlay */
#med-rec-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: medRecFadeIn 0.25s ease;
}

@keyframes medRecFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Box */
#med-rec-modal {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    color: #050505;
    font-family: 'Poppins', 'Inter', sans-serif;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(76, 175, 80, 0.15);
    animation: medRecSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-width: thin;
    scrollbar-color: #4CAF50 #f5f5f5;
}

@keyframes medRecSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close button */
#med-rec-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

#med-rec-close:hover {
    color: #4CAF50;
}

/* Progress bar */
#med-rec-progress-wrap {
    height: 4px;
    background: #e8f5e9;
    border-radius: 4px;
    margin-bottom: 8px;
}

#med-rec-progress-bar {
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #81C784);
    border-radius: 4px;
    width: 25%;
    transition: width 0.4s ease;
}

#med-rec-step-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

/* Headings */
#med-rec-modal-title {
    font-size: 26px;
    font-weight: 700;
    color: #050505;
    margin: 0 0 4px;
}

.med-rec-subtitle {
    font-size: 13px;
    color: #4CAF50;
    margin: 0 0 28px;
    font-weight: 500;
}

.med-rec-step h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8f5e9;
}

.med-rec-step h4 {
    font-size: 13px;
    font-weight: 600;
    color: #4CAF50;
    margin: 18px 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Fields */
.med-rec-field {
    margin-bottom: 16px;
}

.med-rec-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.med-rec-required {
    color: #e53935;
}

.med-rec-hint {
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

.med-rec-field input[type="text"],
.med-rec-field input[type="number"],
.med-rec-field input[type="email"],
.med-rec-field select,
.med-rec-field textarea {
    width: 100%;
    background: #fafafa;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    color: #050505;
    font-family: inherit;
    font-size: 14px;
    padding: 11px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    outline: none;
}

.med-rec-field input:focus,
.med-rec-field select:focus,
.med-rec-field textarea:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    background: #fff;
}

.med-rec-field textarea {
    resize: vertical;
}

.med-rec-field code {
    background: #e8f5e9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #4CAF50;
}

/* Two-column row */
.med-rec-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 500px) {
    .med-rec-row {
        grid-template-columns: 1fr;
    }
}

/* Food habits grid */
.med-rec-food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    /* Updated to handle 4 checkboxes dynamically */
    gap: 12px;
    align-items: start;
}

@media (max-width: 500px) {
    .med-rec-food-grid {
        grid-template-columns: 1fr;
    }
}

/* Goals grid — single column for readability */
.med-rec-goals-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.med-rec-goals-grid .med-rec-checkbox {
    padding: 8px 14px;
}

.med-rec-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
}

.med-rec-checkbox:hover {
    border-color: #4CAF50;
    background: #f1f8f1;
}

.med-rec-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4CAF50;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Tier cards */
.med-rec-tier-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 500px) {
    .med-rec-tier-cards {
        grid-template-columns: 1fr;
    }
}

.med-rec-tier-card {
    cursor: pointer;
    display: block;
}

.med-rec-tier-card input[type="radio"] {
    display: none;
}

.tier-card-inner {
    border: 2px solid #ddd;
    border-radius: 16px;
    padding: 20px;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    text-align: center;
}

.med-rec-tier-card input:checked+.tier-card-inner {
    border-color: #4CAF50;
    background: #f1f8f1;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.15);
}

.tier-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.tier-name {
    font-size: 15px;
    font-weight: 600;
    color: #050505;
    margin-bottom: 4px;
}

.tier-price {
    font-size: 22px;
    font-weight: 700;
    color: #4CAF50;
    margin-bottom: 12px;
}

.tier-card-inner ul {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
    font-size: 12px;
    color: #555;
    line-height: 2;
}

/* Submit button */
#med-rec-submit-btn {
    width: 100%;
    padding: 16px;
    background: #4CAF50;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

#med-rec-submit-btn:hover {
    background: #43A047;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

#med-rec-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.med-rec-disclaimer {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 10px 0 0;
}

/* Navigation */
#med-rec-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 12px;
}

#med-rec-nav button {
    background: #f5f5f5;
    border: 1.5px solid #ddd;
    color: #555;
    font-family: inherit;
    font-size: 14px;
    padding: 10px 22px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#med-rec-nav button:hover {
    border-color: #4CAF50;
    color: #4CAF50;
    background: #f1f8f1;
}

/* ===== RESULTS PANEL ===== */
#med-rec-results {
    padding-top: 10px;
}

.med-rec-result-header {
    text-align: center;
    margin-bottom: 24px;
}

.med-rec-score-badge {
    display: inline-block;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    line-height: 80px;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.score-high {
    background: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}

.score-medium {
    background: #FF9800;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.4);
}

.score-low {
    background: #e53935;
    box-shadow: 0 0 20px rgba(229, 57, 53, 0.4);
}

.med-rec-result-section {
    background: #fafafa;
    border: 1.5px solid #e0e0e0;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.med-rec-result-section h4 {
    font-size: 13px;
    font-weight: 700;
    color: #4CAF50;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px;
}

.med-rec-result-section p,
.med-rec-result-section li {
    font-size: 14px;
    color: #333;
    line-height: 1.7;
    margin: 0;
}

.med-rec-result-section ul {
    padding-left: 20px;
    margin: 0;
}

.med-rec-result-section li {
    margin-bottom: 4px;
}

.med-rec-finding {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.med-rec-finding:last-child {
    border-bottom: none;
}

.finding-severity {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sev-high {
    background: rgba(229, 57, 53, 0.1);
    color: #e53935;
}

.sev-moderate {
    background: rgba(255, 152, 0, 0.1);
    color: #FF9800;
}

.sev-low {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.sev-info {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
}

/* Upgrade / Payment Banner */
.med-rec-upgrade-banner {
    background: linear-gradient(135deg, #4CAF50, #81C784);
    border-radius: 14px;
    padding: 24px 20px;
    text-align: center;
    margin-top: 16px;
}

.med-rec-upgrade-banner h4 {
    color: #ffffff;
    font-size: 17px;
    margin: 0 0 8px;
}

.med-rec-upgrade-banner p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0 0 16px;
}

/* Stripe / Checkout button */
.med-rec-pay-btn {
    display: inline-block;
    padding: 14px 36px;
    background: #ffffff;
    color: #4CAF50;
    font-weight: 700;
    border-radius: 50px;
    text-decoration: none !important;
    font-size: 16px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.med-rec-pay-btn:hover {
    background: #f1f8f1;
    transform: translateY(-2px);
}

/* Payment required state */
.med-rec-payment-required {
    text-align: center;
    padding: 20px;
}

.med-rec-payment-required .pay-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.med-rec-payment-required h4 {
    font-size: 20px;
    color: #050505;
    margin: 0 0 10px;
}

.med-rec-payment-required p {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.6;
}

.med-rec-new-check {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    background: #f5f5f5;
    border: 1.5px solid #ddd;
    color: #555;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.med-rec-new-check:hover {
    border-color: #4CAF50;
    color: #4CAF50;
    background: #f1f8f1;
}