/* =========================================================
   CITY GASTRO CARE - MASTER STYLESHEET (CGC PRO v15.1)
========================================================= */

:root {
    --primary: #2c3e50; 
    --primary-hover: #1a252f;
    --doc-color: #0a9396; 
    --rec-color: #2a9d8f;
    --text-color: #1e293b; 
    --text-muted: #64748b;
    --accent-orange: #ee9b00; 
    --danger: #d62828;
    --border-color: #cbd5e1; 
    --bg-input: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.06);
    --transition: all 0.3s ease;
}

* { box-sizing: border-box; scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif; 
    background: var(--bg-gradient);
    margin: 0; 
    padding: 0; 
    color: var(--text-color);
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
   1. PUBLIC LANDING PAGE CSS
========================================================= */
.lp-navbar {
    background-color: rgba(255, 255, 255, 0.98); 
    backdrop-filter: blur(10px);
    padding: 16px 5%; 
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow-sm); position: fixed; top: 0; width: 100%; z-index: 2000;
}
.lp-brand { font-size: 24px; font-weight: 900; color: var(--primary); letter-spacing: -0.5px; }
.lp-brand span { color: var(--danger); }
.lp-nav-links { display: flex; gap: 24px; align-items: center; }
.lp-nav-links a { text-decoration: none; color: var(--text-color); font-weight: 600; font-size: 15px; transition: var(--transition); }
.lp-nav-links a:hover { color: var(--danger); }

.lp-hero {
    padding: 160px 5% 100px 5%; 
    background: linear-gradient(135deg, #e63946 0%, #b91c1c 100%);
    display: flex; flex-direction: column; align-items: center; text-align: center; color: #ffffff;
}
.lp-hero h1 { font-size: 56px; font-weight: 900; margin: 0 0 10px 0; line-height: 1.1; letter-spacing: -1px; }
.lp-hero h2 { font-size: 32px; font-weight: 800; margin: 0 0 5px 0; }
.lp-hero h3 { font-size: 20px; font-weight: 700; color: #fde047; margin: 0 0 20px 0; letter-spacing: 0.5px; }
.lp-hero p { font-size: 20px; color: #f8fafc; max-width: 700px; margin: 0 0 35px 0; line-height: 1.6; opacity: 0.95; }
.lp-hero-btns { display: flex; gap: 15px; justify-content: center; }

.lp-section { padding: 90px 5%; background: #ffffff; }
.lp-section.alt { background: var(--bg-input); }
.lp-section-title { font-size: 36px; font-weight: 800; color: var(--primary); text-align: center; margin-bottom: 50px; letter-spacing: -0.5px; }

.checkin-banner { background: #fffbeb; border: 2px dashed #f59e0b; padding: 25px; border-radius: 12px; text-align: center; max-width: 800px; margin: 0 auto; }
.checkin-banner h3 { color: #b45309; margin: 0 0 10px 0; font-size: 22px; }
.checkin-banner p { color: #92400e; font-size: 15px; margin: 0 0 20px 0; font-weight: 600; }

.lp-about-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; max-width: 1000px; margin: 0 auto; align-items: center; }
.lp-doc-img { width: 100%; aspect-ratio: 1/1; background: #e2e8f0; border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.lp-doc-info h3 { font-size: 32px; font-weight: 900; margin: 0 0 5px 0; color: var(--text-dark); }
.lp-doc-info h4 { font-size: 18px; color: var(--primary); margin: 0 0 20px 0; font-weight: 600; }
.lp-doc-info p { font-size: 16px; line-height: 1.8; margin-bottom: 15px; text-align: justify; }

.lp-services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; max-width: 1100px; margin: 0 auto; }
.lp-service-card { background: #ffffff; padding: 30px; border-radius: 16px; box-shadow: var(--shadow-md); border-top: 4px solid var(--danger); transition: var(--transition); }
.lp-service-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.lp-contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; max-width: 1100px; margin: 0 auto; }
.lp-contact-card { background: #ffffff; padding: 35px; border-radius: 16px; box-shadow: var(--shadow-md); border-top: 4px solid var(--primary); }

.lp-reviews-section { padding: 80px 0; background: #f8fafc; overflow: hidden; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.lp-rating-badge { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 40px; }
.lp-rating-score { font-size: 48px; color: #3c4043; line-height: 1; }

.lp-reviews-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; gap: 20px; padding: 20px 10px; scrollbar-width: none; }
.lp-reviews-track::-webkit-scrollbar { display: none; }
.lp-review-card { flex: 0 0 calc(100% - 40px); max-width: 400px; scroll-snap-align: center; background: #ffffff; padding: 24px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: 1px solid #e2e8f0; }

.lp-review-header { display: flex; align-items: center; margin-bottom: 14px; position: relative; }
.lp-review-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 18px; margin-right: 12px; flex-shrink: 0; }
.lp-review-name { font-size: 15px; font-weight: 700; color: #202124; margin-bottom: 2px; }
.lp-review-guide { font-size: 12px; color: #70757a; display: flex; align-items: center; gap: 4px; }
.lp-google-icon { position: absolute; top: 0; right: 0; width: 20px; height: 20px; }
.lp-review-stars { color: #fbbc04; font-size: 16px; letter-spacing: 1px; }
.lp-review-time { font-size: 13px; color: #70757a; margin-left: 8px; }
.lp-review-text { font-size: 14px; color: #3c4043; line-height: 1.5; margin-top: 12px; }

.timing-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--border-color); font-size: 15px; }
.timing-day { font-weight: 700; }
.timing-time { font-weight: 600; color: var(--doc-color); text-align: right; }

.floating-call-btn {
    position: fixed; bottom: 30px; right: 30px; background-color: #25D366; color: #ffffff;
    border-radius: 50px; padding: 14px 28px; display: flex; align-items: center; gap: 10px;
    font-size: 16px; font-weight: 800; text-decoration: none; z-index: 9999;
    animation: pulse-green 2s infinite;
}
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }

.fade-in-section { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.fade-in-section.is-visible { opacity: 1; transform: none; }


/* =========================================================
   2. PRIVATE DASHBOARD CSS (app.html)
========================================================= */
.header-bar {
    background-color: var(--primary); color: #ffffff; padding: 14px 24px; display: flex; 
    justify-content: space-between; align-items: center; box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    flex-wrap: wrap; gap: 10px; position: sticky; top: 0; z-index: 1000;
}
.header-bar h2 { margin: 0; font-size: 20px; font-weight: 800; cursor: pointer; transition: opacity 0.2s; }
.header-bar h2:hover { opacity: 0.8; }
.nav-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-badge { background: rgba(255, 255, 255, 0.18); padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }

.btn {
    padding: 10px 18px; border: none; border-radius: 8px; cursor: pointer;
    font-weight: 600; color: #ffffff; font-size: 14px; font-family: 'Inter', sans-serif;
    box-shadow: var(--shadow-sm); transition: all 0.1s ease-in-out;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn.large { padding: 14px 28px; font-size: 16px; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); opacity: 0.95; }
.btn:disabled { background: #cbd5e1 !important; cursor: not-allowed; transform: none; box-shadow: none; color: #64748b; }

.btn-primary { background: var(--primary); }
.btn-doc { background: var(--doc-color); }
.btn-rec { background: var(--rec-color); }
.btn-accent { background: var(--accent-orange); }
.btn-purple { background: #8e44ad; }
.btn-danger { background: var(--danger); }
.btn-white { background: #ffffff; color: var(--danger); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: #ffffff; }

.tab-btn { opacity: 0.4; transition: opacity 0.2s ease; }
.tab-btn.active-tab { opacity: 1; }

.container { flex: 1; max-width: 1120px; margin: 0 auto; padding: 24px 16px; width: 100%; }

.view { display: none; opacity: 0; transition: opacity 0.15s ease-in-out; }
.view.active { display: block; opacity: 1; animation: fadeIn 0.15s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.card { background: #ffffff; padding: 28px; border-radius: 14px; box-shadow: var(--shadow-lg); margin-bottom: 24px; border-top: 4px solid var(--primary); }

.analytics-container { text-align: center; width: 100%; margin-bottom: 22px; }
.analytics-banner {
    display: inline-block; background-color: #ffffff; color: var(--primary);
    padding: 8px 24px; font-weight: 800; border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: 1px solid rgba(44, 62, 80, 0.15); font-size: 14px;
}
.date-badge { background-color: #e0f2fe; color: #0284c7; padding: 6px 16px; border-radius: 20px; font-weight: 800; font-size: 14px; display: inline-block; margin: 20px 0 10px 0; border: 1px solid #bae6fd; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 22px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--primary); text-transform: uppercase; }
.form-group input, .form-group select { width: 100%; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 14px; outline: none; background-color: var(--bg-input); }

.table-responsive { width: 100%; overflow-x: auto; border-radius: 8px; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; background: #ffffff; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background-color: #f1f5f9; color: var(--primary); font-weight: 700; text-transform: uppercase; font-size: 12px; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.chart-container { position: relative; height: 300px; width: 100%; }
.chart-container.large { height: 350px; }

.history-timeline { position: relative; border-left: 3px solid var(--border-color); margin-left: 20px; padding-left: 30px; margin-top: 25px; }
.timeline-card { background: #f8fafc; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; margin-bottom: 25px; position: relative; box-shadow: var(--shadow-sm); }
.timeline-card::before { content: ''; position: absolute; left: -38.5px; top: 20px; width: 14px; height: 14px; background: var(--doc-color); border-radius: 50%; border: 3px solid #ffffff; box-shadow: 0 0 0 2px var(--border-color); }
.timeline-date { font-weight: 800; color: var(--doc-color); margin-bottom: 10px; display: block; font-size: 14px; }
.timeline-diag { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.timeline-meds { font-size: 14px; color: var(--text-color); white-space: pre-wrap; margin-top: 10px; background: #ffffff; padding: 12px; border-radius: 8px; border: 1px dashed var(--border-color); }

/* =========================================================
   3. CLINICAL PADS CSS (Rx, Referral, Med Cert)
========================================================= */
.rx-pad { background: #ffffff; border: 1px solid #e2e8f0; padding: 25px 30px; border-radius: 12px; display: flex; flex-direction: column; position: relative; margin-bottom: 20px; box-shadow: var(--shadow-sm); }

.rx-header-top { display: flex; justify-content: space-between; align-items: stretch; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 3px solid #1e293b; }
.header-left h1 { margin: 0; font-size: 34px; font-weight: 900; color: #1e293b; line-height: 1.1; }
.header-left p { margin: 4px 0 0 0; font-size: 12px; font-weight: 800; color: #1e293b; text-transform: uppercase; line-height: 1.4; }

.header-right { text-align: right; border-left: 2px solid #1e293b; padding-left: 15px; margin-left: 15px; display: flex; flex-direction: column; justify-content: center; }
.header-right h2 { margin: 0; font-size: 18px; color: #475569; font-weight: 800; }
.header-right p { margin: 4px 0 0 0; font-size: 11px; line-height: 1.4; color: #475569; font-weight: 500; }

.patient-details-grid { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-weight: 600; font-size: 15px; color: #1e293b; gap: 10px; width: 100%; border-bottom: 1px dashed #e2e8f0; padding-bottom: 10px;}
.patient-details-grid > div { display: flex; align-items: center; white-space: nowrap; }
.patient-details-grid .center-align { justify-content: center; flex: 1; }
.patient-details-grid .right-align { justify-content: flex-end; }

.inline-input { border: none; font-weight: 700; font-size: 15px; font-family: 'Inter', sans-serif; background: transparent; padding: 2px 6px; outline: none; color: #0f172a; width: 100%; border-bottom: 1px solid transparent; transition: 0.15s ease; }
.inline-input:focus { border-bottom-color: var(--primary); background: #f8fafc; }

/* Interactive Clinical Pad Tabs */
.pad-section { padding: 15px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 15px; background: #f8fafc; transition: border-color 0.2s ease; }
.pad-section:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.05); }
.pad-section-header { display: flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 700; margin-bottom: 10px; font-size: 15px; }
.pad-section textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 6px; padding: 12px; font-family: inherit; font-size: 14px; resize: vertical; transition: all 0.2s ease; background: #fff; outline: none; }
.pad-section textarea:focus { border-color: var(--primary); }

.clinical-row { display: flex; align-items: baseline; margin-bottom: 12px; width: 100%; }
.clinical-row strong { width: 140px; color: #1e293b; font-size: 15px; font-weight: 700; flex-shrink: 0; margin-bottom: 4px; }
.clinical-row textarea { flex-grow: 1; border: none; border-bottom: 1px dashed var(--border-color); outline: none; font-size: 15px; font-family: 'Inter', sans-serif; resize: none; padding: 4px 6px; color: #0f172a; width: 100%; }

.smart-bar { background: #f8fafc; border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; margin-bottom: 15px; display: flex; flex-direction: column; gap: 10px; }
.smart-row { display: flex; gap: 8px; overflow-x: auto; white-space: nowrap; padding-bottom: 4px; scrollbar-width: none; align-items: center; }
.smart-row::-webkit-scrollbar { display: none; }
.smart-label { font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-right: 5px; flex-shrink: 0; }
.smart-chip { padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border-color); transition: 0.15s ease; background: #ffffff; user-select: none; }
.med-chip { color: var(--doc-color); border-color: rgba(10, 147, 150, 0.3); }
.med-chip:hover { background: var(--doc-color); color: #ffffff; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.time-chip { color: var(--accent-orange); border-color: rgba(238, 155, 0, 0.3); }
.time-chip:hover { background: var(--accent-orange); color: #ffffff; box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.rx-symbol { font-size: 34px; font-family: serif; font-style: italic; font-weight: 700; color: #1e293b; margin: 5px 0 10px 0; }
.rx-textarea { width: 100%; flex-grow: 1; padding: 14px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px; line-height: 1.6; resize: vertical; min-height: 200px; outline: none; font-family: 'Inter', sans-serif; background: var(--bg-input); }

.locked-field { background-color: #f1f5f9 !important; cursor: not-allowed; color: #475569 !important; border-bottom: none !important; }

.pad-wrapper { display: none; opacity: 0; transition: opacity 0.15s ease; }
.pad-wrapper.active { display: flex; opacity: 1; flex-direction: column; }

.fluid-editable { border-bottom: 1px dashed var(--border-color); outline: none; display: inline-block; min-width: 40px; padding: 0 4px; color: #0f172a; vertical-align: bottom; }
.fluid-editable:focus { border-bottom: 1px solid var(--primary); background: #f8fafc; }
.fluid-text { color: #0f172a; }

/* THE FIX: HIDE PRINT ELEMENTS ON SCREEN GLOBALLY */
.print-only-inline { display: none; font-weight: 700; font-size: 15px; color: #000000; padding-left: 5px; min-width: 30px; border-bottom: 1px solid #e2e8f0; }
.print-only-signature { display: none; }
.print-only-value { display: none; }
.print-only-footer { display: none; }

.app-footer { background: #000000; color: #e2e8f0; text-align: center; padding: 20px 16px; font-size: 13px; margin-top: auto; border-top: 4px solid var(--primary); line-height: 1.6; }
.app-footer strong { color: #ffffff; font-weight: 700; }

@media (max-width: 768px) {
    .lp-nav-links a { display: none; } 
    .lp-about-grid { grid-template-columns: 1fr; }
    .lp-hero h1 { font-size: 40px; }
    .patient-details-grid { flex-direction: column; align-items: flex-start; }
    .patient-details-grid > div { width: 100%; justify-content: flex-start !important; margin-bottom: 5px; }
    .clinical-row { flex-direction: column; }
}

/* =========================================================
   4. STRICT A4 PRINT CSS (Restored to v13 Stable Architecture)
========================================================= */
@media print {
    @page { size: A4 portrait; margin: 0; }
    
    body { background: #ffffff !important; margin: 0 !important; padding: 0 !important; color: #000000 !important; font-family: 'Inter', sans-serif !important; }
    
    .header-bar, .app-footer, .non-printable, .nav-group, textarea, .rx-textarea, .smart-bar, .lp-navbar, .lp-hero, .lp-section, .lp-reviews-section, .floating-call-btn, #read-only-banner, #wrap-smart-bar, .tab-btn, button { display: none !important; }
    
    .container { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
    
    .pad-wrapper { display: none !important; }
    .pad-wrapper.active { display: block !important; }
    .hidden-for-print { display: none !important; height: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; }

    .inline-input { display: none !important; }
    .print-only-inline { display: inline-block !important; border-bottom: none !important; }

    .rx-pad { 
        border: none !important; box-shadow: none !important; 
        padding: 15mm 15mm 60mm 15mm !important; margin: 0 !important; 
        height: 100vh !important; /* Forces exactly one page */
        max-height: none !important; 
        position: relative !important; 
        overflow: visible !important; 
        background: transparent !important;
    }

    .rx-header-top { display: flex !important; flex-direction: row !important; justify-content: space-between !important; align-items: stretch !important; border-bottom: 3px solid #000 !important; margin-bottom: 15px !important;}
    .header-left { text-align: left !important; max-width: 55% !important; flex: 1 !important; }
    .header-right { text-align: right !important; max-width: 45% !important; flex: 1 !important; border-left: 2px solid #000 !important; padding-left: 15px !important; margin-left: 15px !important; }

    .patient-details-grid { display: flex !important; flex-direction: row !important; justify-content: space-between !important; width: 100% !important; border-bottom: none !important; margin-bottom: 10px !important;}
    .patient-details-grid .center-align { justify-content: center !important; }
    .patient-details-grid .right-align { justify-content: flex-end !important; }

    .print-only-value:not(.hidden-for-print) { 
        display: block !important; border-bottom: 1px dashed #cbd5e1; padding: 4px 0; font-size: 16px; white-space: pre-wrap; word-wrap: break-word; color: #000000; min-height: 20px;
    }

    /* Explicit Follow Up Print Relocation - Bottom Left above Signature */
    #print-fol-wrapper {
        position: absolute !important;
        bottom: 50mm !important;
        left: 15mm !important;
        margin: 0 !important;
        border-bottom: none !important;
        max-width: 60% !important;
    }

    .fluid-editable { border-bottom: none !important; font-weight: 600 !important;}
    .print-block { display: block !important; }

    /* Force Signature and Footer to absolute bottom of the relative 100vh container */
    .print-only-signature { 
        display: block !important; position: absolute !important; 
        bottom: 25mm !important; right: 15mm !important; 
        width: 200px !important; text-align: center !important; 
    }
    
    .print-only-footer {
        display: flex !important; justify-content: space-between !important;
        position: absolute !important; bottom: 10mm !important; left: 15mm !important; right: 15mm !important;
        border-top: 3px solid #000 !important; padding-top: 5px !important; font-size: 11px !important; font-weight: 600 !important;
    }
}