/* Doctor Portal Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    min-height: 100vh;
}

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo-container {
    margin-bottom: 30px;
}

.logo-container img {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    margin: 0 auto;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    object-fit: contain;
    background: white;
    padding: 10px;
}

.logo-placeholder {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #4A90E2, #357ABD);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: white;
    font-size: 48px;
    font-weight: bold;
}

.login-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.login-header h1 img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.login-header p {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
    box-sizing: border-box; /* Ensure padding is included in width calculation */
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4A90E2;
}

.form-group input[type="file"] {
    padding: 8px;
    cursor: pointer;
    background: #f8f9fa;
}

.form-group input[type="file"]:hover {
    background: #e9ecef;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    overflow-y: auto;
}

/* Specific styling for Doctor Search Portals textarea */
#doctorSearchPortals {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 96px; /* Approximately 3 lines: (16px font * 1.5 line-height * 3) + 24px padding */
    max-height: 96px;
    overflow-y: auto;
    resize: none; /* Prevent manual resizing to maintain 3-line height */
    line-height: 1.5;
    box-sizing: border-box !important; /* Ensure padding is included in width calculation */
    padding: 12px !important; /* Match input padding exactly */
    margin: 0 !important; /* Remove any default margins */
    border: 1px solid #ddd !important; /* Match input border exactly */
    border-radius: 8px !important; /* Match input border-radius exactly */
    font-size: 16px !important; /* Match input font-size exactly */
    font-family: inherit !important; /* Match input font-family exactly */
    display: block !important;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover:not(:disabled) {
    background: #357ABD;
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.doctor-portal {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
    min-height: 100vh;
}

.admin-header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
}

.header-left h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-email {
    color: #666;
    font-size: 14px;
}

.logout-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c82333;
}

.screen-header {
    background: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.screen-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.screen-header h2 img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.portal-tabs-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.portal-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.portal-tab {
    padding: 12px 24px;
    border: 2px solid #4A90E2;
    background: white;
    color: #4A90E2;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-tab:hover {
    background: #f0f7ff;
}

.portal-tab.active {
    background: #4A90E2;
    color: white;
}

.tab-description {
    margin-bottom: 16px;
    color: #666;
    font-size: 14px;
}

.screen-header p {
    color: #666;
    font-size: 14px;
}

.search-container {
    flex: 1;
    min-width: 200px;
}

.search-container input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.patient-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.patient-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.patient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.patient-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.patient-card-header h3 {
    margin: 0;
    flex: 1;
    color: #333;
}

.patient-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.patient-badge--self {
    background: #e3f2fd;
    color: #1976d2;
}

.patient-badge--family {
    background: #f3e5f5;
    color: #7b1fa2;
}

.patient-card p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.note-card .note-preview {
    max-height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.detail-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.detail-table th, .detail-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eee; }
.detail-table th { color: #666; font-weight: 600; }

.patient-id {
    font-family: monospace;
    font-size: 12px;
    color: #999;
}

.no-data-message {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.no-data-message i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 16px;
}

.no-data-message p {
    color: #666;
    font-size: 16px;
}

/* Create clinic modal - scrollable */
.create-clinic-modal-box {
    -webkit-overflow-scrolling: touch;
}
.create-clinic-modal-box .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

/* Clinic management */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #f8f9fa;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn:hover { background: #e9ecef; }
.btn-primary { background: #4A90E2; color: white; border-color: #4A90E2; }
.btn-primary:hover { background: #357ABD; }
.btn-outline { background: transparent; border-color: #4A90E2; color: #4A90E2; }
.btn-outline:hover { background: #e3f2fd; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #cce5ff; color: #004085; }
.badge-primary { background: #cce5ff; color: #004085; }
.badge-danger { background: #f8d7da; color: #721c24; }
.clinic-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.form-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-inline input, .form-inline select { padding: 8px; border-radius: 6px; border: 1px solid #ddd; }

/* Appointments filters */
.appointments-filters { background: white; border-radius: 12px; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.filter-btn { padding: 8px 16px; border-radius: 8px; border: 1px solid #ddd; background: #f8f9fa; cursor: pointer; }
.filter-btn.active { background: #4A90E2; color: white; border-color: #4A90E2; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: #666; }
.filter-group input, .filter-group select { padding: 8px; border-radius: 6px; border: 1px solid #ddd; }
.view-toggle { display: flex; gap: 8px; margin-left: auto; }
.view-btn { padding: 8px 12px; border-radius: 8px; border: 1px solid #ddd; background: #f8f9fa; cursor: pointer; }
.view-btn.active { background: #4A90E2; color: white; border-color: #4A90E2; }
.appointment-cancelled { opacity: 0.6; background: #f5f5f5; }
.detail-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee; }

/* Appointment modal: patient notes (override any centered parent) */
.appointment-patient-notes-section {
    align-self: stretch;
    width: 100%;
    text-align: left !important;
}
.appointment-patient-notes-heading {
    text-align: left !important;
    width: 100%;
}
.appointment-detail-modal-box {
    text-align: left !important;
}
.appointment-detail-modal-box .detail-table,
.appointment-detail-modal-box .detail-section {
    text-align: left !important;
}

.appointment-patient-notes-body {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    white-space: pre-wrap;
    text-align: left !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.hint { font-size: 12px; color: #666; margin-top: 8px; }
.pagination { text-align: center; padding: 16px; }
.calendar-view { display: flex; flex-direction: column; gap: 24px; }
.calendar-day h4 { margin-bottom: 12px; color: #4A90E2; }
.calendar-day-appts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.header-link { color: #4A90E2; text-decoration: none; font-size: 14px; }
.header-link:hover { text-decoration: underline; }
.patient-appointments-link { color: #4A90E2; text-decoration: none; font-size: 14px; }
.patient-appointments-link:hover { text-decoration: underline; }

/* Patient View - matches doctor portal design */
.patient-view-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: #f5f5f5;
  min-height: 100vh;
}

.patient-view-header {
  background: white;
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.patient-view-header h1 {
  margin: 0;
  color: #2c3e50;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-view-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4A90E2;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

.patient-view-header .back-link:hover {
  text-decoration: underline;
}

.patient-view-nav {
  background: white;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.patient-view-nav .section-btn {
  padding: 10px 18px;
  border: 2px solid #4A90E2;
  background: white;
  color: #4A90E2;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, color 0.2s;
}

.patient-view-nav .section-btn:hover {
  background: #f0f7ff;
}

.patient-view-nav .section-btn.active {
  background: #4A90E2;
  color: white;
}

.patient-view-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.patient-view-content .section-content {
  display: none;
}

.patient-view-content .section-content.active {
  display: block;
}

.patient-view-content .data-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #eee;
}

.patient-view-content .data-section:last-child {
  margin-bottom: 0;
}

.patient-view-content .data-section h3 {
  margin: 0 0 16px;
  color: #2c3e50;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.patient-view-content .data-section h3 i {
  color: #4A90E2;
}

.patient-view-content .data-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  align-items: flex-start;
}

.patient-view-content .data-item:last-child {
  border-bottom: none;
}

.patient-view-content .data-item.clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 -14px;
  transition: background 0.2s;
}

.patient-view-content .data-item.clickable:hover {
  background: #e8f4fc;
}

.patient-view-content .data-label {
  font-weight: 600;
  color: #555;
  min-width: 140px;
  font-size: 14px;
}

.patient-view-content .data-value {
  color: #333;
  flex: 1;
  font-size: 14px;
}

.patient-view-content .empty-section {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 15px;
}

.patient-view-content .my-notes-btn {
  padding: 10px 18px;
  background: #4A90E2;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.patient-view-content .my-notes-btn:hover {
  background: #357ABD;
}

.patient-view-content .my-notes-btn--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.patient-view-content .diet-date-range {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.patient-view-content .diet-date-range input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.patient-view-content .diet-summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: white;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid #eee;
}

.patient-view-content .diet-summary-card .bar {
  width: 4px;
  height: 40px;
  border-radius: 2px;
}

.patient-view-content .diet-summary-card .label {
  font-size: 13px;
  color: #666;
}

.patient-view-content .diet-summary-card .value {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

.patient-view-content .diet-chart-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  border: 1px solid #eee;
}

.patient-view-content .diet-chart-card h4 {
  margin: 0 0 12px;
  color: #2c3e50;
  font-size: 16px;
}

.patient-view-content .diet-chart-canvas {
  height: 200px;
}

#loadingMessage, #errorMessage {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.modal-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #eee;
}

.modal-images.radiology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
