/* ------------------------------------------- */
/* --- GENERAL PAGE LAYOUT & RESPONSIVENESS --- */
/* ------------------------------------------- */

/* Main container for the form and prescription */
#app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    /* Add padding to prevent content from hiding behind fixed header and footer */
    padding-top: 100px;
    padding-bottom: 220px;
}

@media (min-width: 1024px) {
    #app-container {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
    }
}

/* Base styles for the body */
body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #e6e9f0;
    color: #333;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Hide form and other controls when printing */
@media print {
    body { background: none; }
    #input-form, .navbar, .footer, .marquee-band, .skf-float-bubble, .social-icons { display: none; }
    .page {
        box-shadow: none;
        margin: 0;
        padding: 0;
        border: none;
    }
}

/* ------------------------------------------- */
/* --- NAVIGATION AND FOOTER STYLES --- */
/* ------------------------------------------- */

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: linear-gradient(to right, #002244, #003366);
    color: white;
    flex-wrap: wrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid #ffcc00;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar a {
    color: white;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    position: relative;
}

.navbar a::after {
    content: '';
    position: absolute;
    width: 0%;
    height: 2px;
    background: #ffcc00;
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

.navbar a:hover::after {
    width: 100%;
}

.navbar a:hover {
    color: #ffcc00;
}

/* Marquee Band */
.marquee-band {
    background: linear-gradient(to right, #555, #999);
    padding: 12px 0;
    overflow: hidden;
    position: fixed;
    top: 60px;
    width: 100%;
    z-index: 999;
}

.marquee-text {
    display: inline-block;
    white-space: nowrap;
    animation: marquee-scroll 20s linear infinite;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    padding-left: 100%;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-100%); }
}

/* Footer */
.footer {
    background: #003366;
    color: #ffffff;
    text-align: center;
    padding: 30px 20px;
    font-size: 15px;
    line-height: 1.7;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.footer-content p {
    margin: 12px 0;
}

.footer a {
    color: #ffcc00;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Social Icons */
.social-icons {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 999;
}

.social-icons img {
    width: 30px;
    height: 30px;
    transition: transform 0.3s;
}

.social-icons a:hover img {
    transform: scale(1.2);
}

.skf-float-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skf-float-bubble:hover {
    transform: scale(1.1);
    box-shadow: 6px 6px 20px rgba(0,0,0,0.3);
}

.skf-float-bubble img {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    object-fit: cover;
}
/* ------------------------------------------- */
/* --- INPUT FORM STYLES --- */
/* ------------------------------------------- */

#input-form {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    flex-shrink: 0;
    font-family: 'Open Sans', sans-serif;
}

/* Form sections */
.form-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

/* Form headings */
.form-section h3 {
    margin-top: 0;
    font-size: 18px;
    color: #af2b22;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
}

/* Label and input groups */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

/* All input fields */
.form-input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Layout for the medicine rows */
.medicine-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* Add Medicine button */
#add-medicine {
    background-color: #0d6efd;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 600;
}

#add-medicine:hover {
    background-color: #0b5ed7;
}

/* Remove button for medicine rows */
.remove-medicine {
    background-color: #dc3545;
    color: #fff;
    border: none;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
}

/* Action buttons at the bottom of the form */
#action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Download button */
#download-button {
    flex-grow: 1;
    padding: 12px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#download-button:hover {
    background-color: #218838;
}

/* Save button */
#save-button {
    flex-grow: 1;
    padding: 12px;
    background-color: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#save-button:hover {
    background-color: #0b5ed7;
}

/* ------------------------------------------- */
/* --- PRESCRIPTION TEMPLATE STYLES --- */
/* ------------------------------------------- */

/* A4 Page and Print Setup */
@page {
    size: A4;
    margin: 0;
}

.page {
    width: clamp(300px, 50vw, 210mm);
    height: auto;
    aspect-ratio: 210 / 297;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 10mm rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('YOUR_CLINIC_STAMP_IMAGE_URL_HERE');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 80mm;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

#main-body-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150mm;
    height: 150mm;
    background-image: url('kidney.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

/* Header section */
#header-container {
    background-color: #fce8d5;
    padding: 10mm 15mm 5mm 15mm;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

#header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 3mm;
    border-bottom: 1px solid #c0c0c0;
    margin-bottom: 5mm;
}

.header-left {
    flex-basis: 55%;
    padding-right: 5mm;
    box-sizing: border-box;
}

.header-right {
    flex-basis: 45%;
    text-align: right;
    line-height: 1.4;
}

.doctor-name-main {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #af2b22;
    margin: 0;
    text-transform: uppercase;
}

.doctor-qualifications {
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin: 1mm 0 0 0;
    line-height: 1.3;
}

.doctor-details-left {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #666;
    margin-top: 3mm;
    line-height: 1.4;
}

.website-link {
    font-size: 10px;
    color: #0d6efd;
    text-decoration: underline;
    font-weight: 600;
}

.consulting-time {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #666;
    margin-top: 3mm;
    font-weight: 500;
    text-align: center;
    background-color: #e0e0e0;
    padding: 2mm 0;
}

.online-consultation-header {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    margin: 3mm 0 0 0;
    padding: 2mm 0;
    background-color: #b3d9ff;
    border: 1px solid #0d6efd;
    color: #0d6efd;
    text-transform: uppercase;
}

.online-consultation-header a {
    color: #0d6efd;
    text-decoration: underline;
}

.residence-info {
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    color: #444;
    margin: 0;
    font-weight: 500;
}

.address-phone-right {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #666;
    margin-top: 1mm;
    line-height: 1.4;
}

/* Patient info section and main body */
#main-body-content {
    flex-grow: 1;
    padding: 0 15mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

#patient-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 14px;
    padding: 5mm 0;
    border-bottom: 1px dashed #ccc;
    margin-bottom: 8mm;
}

.patient-field {
    display: flex;
    align-items: flex-end;
}

.patient-field .label {
    font-weight: 500;
    color: #444;
    margin-right: 2mm;
    white-space: nowrap;
}

.patient-field .value-line {
    border-bottom: 1px dashed #666;
    flex-grow: 1;
    min-width: 25mm;
    height: 5mm;
}

/* Main prescription content area */
#rx-body {
    position: relative;
    flex-grow: 1;
    padding-top: 5mm;
    line-height: 1.8;
    font-size: 15px;
}

#rx-body::before {
    content: '℞';
    font-family: 'Playfair Display', serif;
    font-size: 40px;
    font-style: italic;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.15);
    position: absolute;
    top: 0;
    left: 0;
    line-height: 1;
}

/* Footer section */
#footer-container {
    background-color: #fce8d5;
    padding: 10mm 15mm 5mm 15mm;
    box-sizing: border-box;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

#footer {
    border-top: 1px solid #ccc;
    font-size: 11px;
    color: #555;
    text-align: center;
    line-height: 1.5;
}

.footer-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10mm;
    margin: 0 auto;
    text-align: center;
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-info-label {
    font-weight: 600;
    color: #444;
    font-size: 10px;
    margin: 0;
}

.footer-info-value {
    font-weight: 500;
    color: #333;
    font-size: 11px;
    margin: 1mm 0 0 0;
}

/* Reset & General Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f9f9f9;
    color: #222;
    transition: background 0.3s, color 0.3s;
    line-height: 1.6;
    padding-top: 150px;
    padding-bottom: 220px;
}

.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: linear-gradient(to right, #002244, #003366);
    color: white;
    flex-wrap: wrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid #ffcc00;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar a {
    color: white;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    position: relative;
}

.navbar a::after {
    content: '';
    position: absolute;
    width: 0%;
    height: 2px;
    background: #ffcc00;
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

.navbar a:hover::after {
    width: 100%;
}

.navbar a:hover {
    color: #ffcc00;
}

/* Marquee Band */
.marquee-band {
    background: linear-gradient(to right, #555, #999);
    padding: 12px 0;
    overflow: hidden;
    position: fixed;
    top: 60px;
    width: 100%;
    z-index: 999;
}

.marquee-text {
    display: inline-block;
    white-space: nowrap;
    animation: marquee-scroll 20s linear infinite;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    padding-left: 100%;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-100%); }
}

/* Social Icons */
.social-icons {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 999;
}

.social-icons img {
    width: 30px;
    height: 30px;
    transition: transform 0.3s;
}

.social-icons a:hover img {
    transform: scale(1.2);
}

.skf-float-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skf-float-bubble:hover {
    transform: scale(1.1);
    box-shadow: 6px 6px 20px rgba(0,0,0,0.3);
}

.skf-float-bubble img {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    object-fit: cover;
}
/* ------------------------------------------- */
/* --- INPUT FORM STYLES --- */
/* ------------------------------------------- */

#input-form {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    flex-shrink: 0;
    font-family: 'Open Sans', sans-serif;
}

/* Form sections */
.form-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

/* Form headings */
.form-section h3 {
    margin-top: 0;
    font-size: 18px;
    color: #af2b22;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
}

/* Label and input groups */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

/* All input fields */
.form-input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Layout for the medicine rows */
.medicine-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* Add Medicine button */
#add-medicine {
    background-color: #0d6efd;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 600;
}

#add-medicine:hover {
    background-color: #0b5ed7;
}

/* Remove button for medicine rows */
.remove-medicine {
    background-color: #dc3545;
    color: #fff;
    border: none;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
}

/* Action buttons at the bottom of the form */
#action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Download button */
#download-button {
    flex-grow: 1;
    padding: 12px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#download-button:hover {
    background-color: #218838;
}

/* Save button */
#save-button {
    flex-grow: 1;
    padding: 12px;
    background-color: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#save-button:hover {
    background-color: #0b5ed7;
}

/* ------------------------------------------- */
/* --- PRESCRIPTION TEMPLATE STYLES --- */
/* ------------------------------------------- */

/* A4 Page and Print Setup */
@page {
    size: A4;
    margin: 0;
}

.page {
    width: clamp(300px, 50vw, 210mm);
    height: auto;
    aspect-ratio: 210 / 297;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 10mm rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('YOUR_CLINIC_STAMP_IMAGE_URL_HERE');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 80mm;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

#main-body-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150mm;
    height: 150mm;
    background-image: url('kidney.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

/* Header section */
#header-container {
    background-color: #fce8d5;
    padding: 10mm 15mm 5mm 15mm;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

#header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 3mm;
    border-bottom: 1px solid #c0c0c0;
    margin-bottom: 5mm;
}

.header-left {
    flex-basis: 55%;
    padding-right: 5mm;
    box-sizing: border-box;
}

.header-right {
    flex-basis: 45%;
    text-align: right;
    line-height: 1.4;
}

.doctor-name-main {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #af2b22;
    margin: 0;
    text-transform: uppercase;
}

.doctor-qualifications {
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin: 1mm 0 0 0;
    line-height: 1.3;
}

.doctor-details-left {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #666;
    margin-top: 3mm;
    line-height: 1.4;
}

.website-link {
    font-size: 10px;
    color: #0d6efd;
    text-decoration: underline;
    font-weight: 600;
}

.consulting-time {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #666;
    margin-top: 3mm;
    font-weight: 500;
    text-align: center;
    background-color: #e0e0e0;
    padding: 2mm 0;
}

.online-consultation-header {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    margin: 3mm 0 0 0;
    padding: 2mm 0;
    background-color: #b3d9ff;
    border: 1px solid #0d6efd;
    color: #0d6efd;
    text-transform: uppercase;
}

.online-consultation-header a {
    color: #0d6efd;
    text-decoration: underline;
}

.residence-info {
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    color: #444;
    margin: 0;
    font-weight: 500;
}

.address-phone-right {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #666;
    margin-top: 1mm;
    line-height: 1.4;
}

/* Patient info section and main body */
#main-body-content {
    flex-grow: 1;
    padding: 0 15mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

#patient-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 14px;
    padding: 5mm 0;
    border-bottom: 1px dashed #ccc;
    margin-bottom: 8mm;
}

.patient-field {
    display: flex;
    align-items: flex-end;
}

.patient-field .label {
    font-weight: 500;
    color: #444;
    margin-right: 2mm;
    white-space: nowrap;
}

.patient-field .value-line {
    border-bottom: 1px dashed #666;
    flex-grow: 1;
    min-width: 25mm;
    height: 5mm;
}

/* Main prescription content area */
#rx-body {
    position: relative;
    flex-grow: 1;
    padding-top: 5mm;
    line-height: 1.8;
    font-size: 15px;
}

#rx-body::before {
    content: '℞';
    font-family: 'Playfair Display', serif;
    font-size: 40px;
    font-style: italic;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.15);
    position: absolute;
    top: 0;
    left: 0;
    line-height: 1;
}

/* Footer section */
#footer-container {
    background-color: #fce8d5;
    padding: 10mm 15mm 5mm 15mm;
    box-sizing: border-box;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

#footer {
    border-top: 1px solid #ccc;
    font-size: 11px;
    color: #555;
    text-align: center;
    line-height: 1.5;
}

.footer-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10mm;
    margin: 0 auto;
    text-align: center;
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-info-label {
    font-weight: 600;
    color: #444;
    font-size: 10px;
    margin: 0;
}

.footer-info-value {
    font-weight: 500;
    color: #333;
    font-size: 11px;
    margin: 1mm 0 0 0;
}
