/*
 * Frontend Styles for Yatta Medical Directory
 * [Version 6.1 - Final Corrected Styles for All Views]
 */

/* ==========================================================================
   1. SHARED: Buttons, Loaders & General Notices
   ========================================================================== */

.ymd-button {
    font-family: inherit;
    background-color: #f6f7f7;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
    color: #333;
}
.ymd-button:hover {
    border-color: #999;
    background-color: #f0f0f0;
}
.ymd-button.ymd-button-primary { background-color: #0073aa; color: #fff; border-color: #0073aa; }
.ymd-button.ymd-button-primary:hover { background-color: #005a87; }
.ymd-button.ymd-button-secondary { background-color: #e65100; color: white; border-color: #e65100; }
.ymd-button:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    background-color: #dcdcdc !important;
    color: #a0a5aa !important;
    border-color: #c3c4c7 !important;
}
.btn-icon { font-size: 1.2em; }

.ymd-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.ymd-notice { text-align: center; background: #fff8e1; padding: 15px; border-radius: 4px; color: #5c3b00; margin-top: 1rem; }
.ymd-notice.error { background-color: #fbeae5; color: #d63608; }


/* ==========================================================================
   2. PUBLIC VIEW: Standard List Display Styles
   ========================================================================== */
.ymd-actions-container {
    display: flex;
    justify-content: flex-start; /* Default for public view */
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}
.ymd-report-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.ymd-report-actions .ymd-loader { display: none; }
   
.ymd-web-view-container { font-family: 'Riwaa-Regular', sans-serif; display: flex; flex-direction: column; gap: 25px; margin-top: 25px; max-width: 800px; margin-left: auto; margin-right: auto; }
h2.ymd-region-title { font-family: 'Riwaa-Heavy', sans-serif; font-size: 2em; color: #2c3e50; margin: 40px 0 15px; padding-bottom: 10px; border-bottom: 3px solid #3498db; text-align: right; }
.ymd-pharmacy-web-card { direction: rtl; background-color: #ffffff; border: 1px solid #e0e0e0; border-right: 5px solid #3498db; border-radius: 8px; padding: 25px; box-shadow: 0 3px 8px rgba(0,0,0,0.07); transition: all 0.2s ease-in-out; position: relative; overflow: hidden; }
.ymd-pharmacy-web-card:hover { transform: translateY(-5px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.ymd-pharmacy-web-card.on-duty-card { border-right-color: #2ecc71; }
.ymd-pharmacy-web-card h3.web-card-title { font-family: 'Riwaa-Heavy', sans-serif; font-size: 1.6em; margin: 0 0 18px 0; color: #1d2327; }
.ymd-pharmacy-web-card p { font-size: 1.1em; color: #50575e; margin: 10px 0; line-height: 1.7; display: flex; align-items: flex-start; }
.ymd-pharmacy-web-card p:last-child { margin-bottom: 0; }
p.web-card-pharmacist { opacity: 0.9; }
.web-card-phone a { color: #0073aa; text-decoration: none; font-weight: bold; }
.duty-badge { position: absolute; top: 15px; left: -45px; background-color: #2ecc71; color: white; padding: 5px 40px; font-size: 0.9em; transform: rotate(-45deg); box-shadow: 0 0 5px rgba(0,0,0,0.2); width: 160px; text-align: center; }

/* ==========================================================================
   3. REPORT MANAGER: Specific Styles
   ========================================================================== */
.ymd-report-manager-wrapper { max-width: 960px; margin: 2rem auto; padding: 1.5rem; background: #fff; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.08); font-family: 'Riwaa-Regular', sans-serif; }
.rm-loader-wrapper { display: none; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 1rem; text-align: center; }
.rm-loader-wrapper .ymd-loader { width: 30px; height: 30px; }
.rm-loader-wrapper.is-active { display: flex; }
.rm-content-wrapper { display: none; }
.rm-content-wrapper.is-active { display: block; }
.rm-section { border-bottom: 1px solid #e0e0e0; padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.rm-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rm-section h3 { font-family: 'Riwaa-Heavy', sans-serif; font-size: 1.5rem; color: #2c3e50; margin-bottom: 1rem; }
.rm-input { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; background-color: #fff; }

/* Controls Section */
.rm-controls-section { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.rm-control-group { display: flex; align-items: center; gap: 0.5rem; }
.rm-control-group label { font-weight: bold; }
.rm-button-reset { background-color: #d9534f; border-color: #d43f3a; color: white; }
.rm-button-reset:hover { background-color: #c9302c; }

/* Pharmacy List Section */
#rm-pharmacy-search { width: 100%; margin-bottom: 1rem; }
#rm-pharmacy-list-container { display: flex; flex-direction: column; gap: 0.5rem; max-height: 50vh; overflow-y: auto; padding: 0.5rem; border: 1px solid #eee; border-radius: 4px; background: #f9f9f9; }
.rm-pharmacy-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background-color: #fff; border-radius: 4px; transition: background-color 0.2s; user-select: none; cursor: pointer;}
.rm-pharmacy-item:hover { background-color: #f0f8ff; }
.rm-pharmacy-item input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.rm-pharmacy-item label { font-size: 1.1rem; flex-grow: 1; cursor: pointer; margin: 0; }
.rm-pharmacy-item.hidden { display: none; } /* For search */

/* Actions Section */
.rm-actions-buttons { display: flex; gap: 1rem; flex-wrap: wrap;}
.rm-actions-buttons .ymd-button { flex-grow: 1; font-size: 1.2rem; padding: 15px; }
#rm-save-btn .ymd-loader { border-color: rgba(255,255,255,0.2); border-top-color: #fff; width: 20px; height: 20px; }

/* Modal Section */
.ymd-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.ymd-modal-backdrop.is-active { display: flex; }
.ymd-modal-content { background: #f9f9f9; border-radius: 8px; box-shadow: 0 5px 25px rgba(0,0,0,0.2); width: 100%; max-width: 1100px; display: flex; flex-direction: column; max-height: 90vh; }
.ymd-modal-header { padding: 1rem; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 8px 8px 0 0;}
.ymd-modal-header h3 { margin: 0; font-size: 1.3rem; }
.ymd-modal-close { border: none; background: none; font-size: 2rem; cursor: pointer; color: #aaa; line-height: 1; padding: 0 0.5rem; }
.ymd-modal-close:hover { color: #333; }
.ymd-modal-body { padding: 1rem; overflow-y: auto; background-color: #fff; }
#rm-report-preview-area * { word-wrap: break-word; }
.ymd-modal-footer { padding: 1rem; border-top: 1px solid #e0e0e0; display: flex; gap: 1rem; justify-content: flex-end; flex-wrap: wrap;}


/* ==========================================================================
   4. Hidden container for image generation & Capture Area Styles
   ========================================================================== */

#ymd-capture-wrapper { position: absolute; left: -9999px; top: 0; z-index: -1; }
#ymd-copy-report-source { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; }

#ymd-report-to-capture-inner { direction: rtl; background-color: #fff; font-smoothing: antialiased; -webkit-font-smoothing: antialiased; position: relative; overflow: hidden; }
#ymd-report-to-capture-inner * { box-sizing: border-box; margin: 0; padding: 0; letter-spacing: normal !important; word-spacing: normal !important; }
.capture-content { position: relative; z-index: 2; }
.report-header { text-align: center; }
.report-footer { text-align: center; margin-top: 25px; }
.header-logo { display: block; width: 100%; height: auto; margin-bottom: 25px; max-width: none; max-height: none; }
.ymd-region-title-capture { padding: 8px 15px; background-color: #f0f0f0; border-radius: 5px; text-align: right; margin-bottom: 10px; }
.capture-pharmacy-card { border-bottom: 1px dashed #ddd; }
.capture-pharmacy-card:last-of-type { border-bottom: none; }
.styled-element-wrapper { display: flex; align-items: baseline; }
.text-icon { margin-left: 10px; width: 24px; text-align: center; display: inline-block; vertical-align: middle; }
.content { flex: 1; }
.report-header .style-title,
.report-header .style-date,
.report-header .secondary-text,
.report-footer .report-footer-content {
    justify-content: center;
}
.watermark-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; background-position: center; background-repeat: no-repeat; background-size: contain; }