/* ==========================================================================
   Patient portal: styles that lived inline in the old portal views
   (public/views/login.php and friends), plus validation messages, which the
   old AJAX forms showed with alert() instead.
   portal.css is the old assets/css/public.css, unchanged.
   ========================================================================== */

/* Landing page: the three big choices (login.php) */
.ttp-landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ttp-landing-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.ttp-landing-btn:hover { text-decoration: none; }

.ttp-landing-btn-icon {
    font-size: 32px;
    margin-right: 20px;
}

.ttp-landing-btn-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.ttp-landing-btn-text strong {
    font-size: 18px;
    margin-bottom: 4px;
    display: block;
}

.ttp-landing-btn-text small {
    font-size: 14px;
    opacity: 0.8;
}

.ttp-landing-btn-primary {
    background: linear-gradient(135deg, #005D6C 0%, #00434E 100%);
    color: white;
}

.ttp-landing-btn-primary:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(44, 82, 130, 0.3);
}

.ttp-landing-btn-secondary {
    background: #FBFDFD;
    color: #06272E;
    border-color: #DCE7E9;
}

.ttp-landing-btn-secondary:hover {
    background: #EAF4F6;
    border-color: #B9CDD1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ttp-landing-btn-tertiary {
    background: white;
    color: #06272E;
    border-color: #B9CDD1;
}

.ttp-landing-btn-tertiary:hover {
    background: #FBFDFD;
    border-color: #005D6C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Registration form section headings (inline styles on the old form) */
.ttp-form-section {
    margin: 25px 0 15px 0;
    color: #005D6C;
    font-size: 18px;
    border-bottom: 2px solid #DCE7E9;
    padding-bottom: 8px;
}

.ttp-form-section small {
    font-weight: normal;
    color: #6E878D;
}

.ttp-preauth {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 16px;
    border-radius: 6px;
    margin-top: 10px;
}

/* Validation messages under a field */
.ttp-field-error {
    display: block;
    margin-top: 6px;
    font-size: 13.5px;
    color: var(--ttp-bad);
}

[hidden] { display: none !important; }

/* About page tabs (about-ttp.php) */
.ttp-about-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid #DCE7E9;
    margin-bottom: 24px;
}

.ttp-about-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #6E878D;
    margin-bottom: -2px;
    transition: color .15s, border-bottom-color .15s;
}

.ttp-about-tab[aria-selected="true"] { color: #005D6C; border-bottom-color: #005D6C; }
.ttp-about-tab[aria-selected="false"]:hover { color: #3F5C63; border-bottom-color: #B9CDD1; }

.ttp-about-panel-bar {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.ttp-about-panel-bar p { margin: 0; color: #6E878D; font-size: 13px; }

.ttp-about-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #005D6C;
    padding: 6px 14px;
    border: 1px solid #005D6C;
    border-radius: 5px;
    white-space: nowrap;
}

.ttp-about-open:hover { text-decoration: none; background: #EAF4F6; }

.ttp-about-frame {
    border: 1px solid #DCE7E9;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.ttp-about-frame iframe { width: 100%; height: 700px; border: none; display: block; }

/* My Sessions (patient-record.php): appointment rows, the completed and
   cancelled accordions, and shared notes. These were inline on the old page. */
.ttp-appointment-record {
    display: block;
    margin-bottom: 15px;
    border: 1px solid #DCE7E9;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: box-shadow .2s;
}

.ttp-appointment-record.is-past { background: #f9f9f9; }
.ttp-appointment-record:hover { text-decoration: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.ttp-appointment-record h4 { margin: 0 0 5px 0; color: #005D6C; font-size: 18px; }
.ttp-appointment-record.is-past h4 { font-size: 16px; }

.ttp-count {
    background: #EAF4F6;
    color: #00434E;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-left: 8px;
}

.ttp-accordion { margin-bottom: 20px; border-radius: 8px; overflow: hidden; }
.ttp-accordion summary { padding: 15px 20px; cursor: pointer; font-weight: 600; font-size: 16px; }
.ttp-accordion-body { padding: 20px; background: #fff; }
.ttp-accordion-completed { border: 1px solid #d1f2eb; }
.ttp-accordion-completed summary { background: #d1f2eb; color: #0f5132; }
.ttp-accordion-completed .ttp-count { background: #0f5132; color: #d1f2eb; }
.ttp-accordion-cancelled { border: 1px solid #f8d7da; }
.ttp-accordion-cancelled summary { background: #f8d7da; color: #842029; }
.ttp-accordion-cancelled .ttp-count { background: #842029; color: #f8d7da; }

.ttp-note-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2c5282;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.ttp-note-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #718096;
    margin-bottom: 10px;
}

.ttp-note-content { line-height: 1.6; color: #2d3748; }

.ttp-btn-danger { background: #e53e3e; color: #fff; border-color: #e53e3e; }
.ttp-btn-danger:hover { background: #c53030; color: #fff; }

/* The calendar's days and times are links here, not script-driven divs. */
a.ttp-calendar-day, a.ttp-time-slot { text-decoration: none; }
.ttp-calendar-prev.ttp-btn-disabled, .ttp-calendar-next.ttp-btn-disabled { opacity: .4; pointer-events: none; }

/* The hearing-test reminder: strongly encouraged, though not needed to book. */
.ttp-hearing-reminder {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--ttp-warn-bg);
    border: 1px solid var(--ttp-warn-line);
    border-left: 4px solid var(--ttp-warn);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 22px;
}

.ttp-hearing-reminder-icon { font-size: 28px; line-height: 1; }
.ttp-hearing-reminder p { margin: 0 0 12px; color: #5c3b00; font-size: 14.5px; }
.ttp-hearing-reminder .ttp-hearing-reminder-title { margin: 0 0 4px; font-weight: 700; font-size: 16px; color: #744210; }

/* My Health Record (patient-record.php) */
.ttp-medical-entry {
    padding: 20px;
    background: #FBFDFD;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #DCE7E9;
}

.ttp-medical-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; margin-bottom: 15px; }

.ttp-medical-doc {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #DCE7E9;
    border-radius: 4px;
    margin-bottom: 8px;
}

.ttp-inline-upload { margin-top: 15px; padding-top: 15px; border-top: 1px solid #DCE7E9; }
.ttp-inline-upload > summary { display: inline-block; list-style: none; cursor: pointer; }
.ttp-inline-upload > summary::-webkit-details-marker { display: none; }

.ttp-btn-soft-danger { background: #fed7d7 !important; color: #c53030 !important; border-color: #fed7d7 !important; }

.ttp-table-wrap { overflow-x: auto; }

/* My Resources: the old "Files & Work" styles (files-work.php), unchanged, plus the upload toggle. */
.fw-upload > summary { list-style: none; cursor: pointer; }
.fw-upload > summary::-webkit-details-marker { display: none; }
.fw-doc-list, .fw-section > .fw-doc-row + .fw-doc-row { margin-top: 6px; }
.fw-status-new { background: #ede9fe; color: #5b21b6; }
/* ── Sections ── */
.fw-section { margin-top: 24px; }

.fw-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e5e7eb;
}
.fw-section-count {
    background: #e5e7eb;
    color: #374151;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

.fw-empty-section {
    padding: 16px;
    background: #f9fafb;
    border-radius: 6px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}

/* ── Document list ── */
.fw-doc-list { display: flex; flex-direction: column; gap: 6px; }

.fw-doc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    transition: box-shadow .15s, border-color .15s;
}
.fw-doc-row:hover {
    border-color: #005D6C;
    box-shadow: 0 2px 8px rgba(44,82,130,.08);
}
.fw-doc-edit {
    border-left: 3px solid #f59e0b;
}

.fw-doc-icon { font-size: 22px; flex-shrink: 0; width: 28px; text-align: center; }

.fw-doc-info { flex: 1; min-width: 0; }

.fw-doc-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.4;
}
.fw-doc-desc {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fw-doc-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 3px;
}

/* Pills */
.fw-edit-pill {
    font-size: 10px;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    padding: 1px 7px;
}
.fw-status {
    font-size: 10px;
    font-weight: 700;
    border-radius: 20px;
    padding: 1px 7px;
}
.fw-status-open      { background: #f3f4f6; color: #6b7280; }
.fw-status-reviewed  { background: #dbeafe; color: #1e40af; }
.fw-status-completed { background: #dcfce7; color: #15803d; }

/* Action button */
.fw-doc-action { flex-shrink: 0; }

.fw-btn-drive {
    background: #34a853;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    display: inline-block;
    transition: background .15s;
}
.fw-btn-drive:hover { background: #2d8e47; }

.fw-doc-action .ttp-btn {
    font-size: 12px;
    padding: 6px 14px;
    white-space: nowrap;
}

/* Empty state */
.ttp-empty-state { text-align: center; padding: 50px 20px; background: #fff; border-radius: 10px; margin-top: 20px; }
.ttp-empty-state h3 { color: #1f2937; margin: 12px 0 8px; }
.ttp-empty-state p  { color: #6b7280; max-width: 440px; margin: 0 auto; }

@media (max-width: 600px) {
    .fw-doc-row    { flex-wrap: wrap; }
    .fw-doc-action { width: 100%; }
    .fw-doc-action .ttp-btn,
    .fw-btn-drive  { width: 100%; text-align: center; }
}

/* Invoices & Payments: a "to pay" banner with a button per unpaid invoice, then every invoice
   as one line that opens for its dates, download, card payment and questions. The badges,
   payment details and question form keep the old page's styles (invoices-payments.php). */
.ttp-pay-banner {
    background: #f0f9ff;
    border: 2px solid #bfdbfe;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 28px;
}

.ttp-pay-banner.overdue {
    background: #fef2f2;
    border-color: #fecaca;
    border-left-color: #dc2626;
}

.pay-banner-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 12px;
}

.pay-banner-head .amount-label {
    display: block;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 2px;
}

.pay-banner-head .amount-value {
    font-size: 30px;
    font-weight: bold;
    color: #1f2937;
}

.summary-alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
}

.pay-banner-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pay-banner-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px 16px;
    padding: 10px 0;
    border-top: 1px solid rgba(37, 99, 235, 0.15);
}

.ttp-pay-banner.overdue .pay-banner-list li { border-top-color: rgba(220, 38, 38, 0.15); }

.pay-banner-invoice strong { display: block; color: #1f2937; font-size: 15px; }
.pay-banner-invoice span { color: #4b5563; font-size: 13px; }
.pay-banner-due { color: #6b7280; font-size: 13px; white-space: nowrap; }
.pay-banner-due.overdue { color: #dc2626; font-weight: 600; }
.pay-banner-amount { font-size: 17px; color: #1f2937; }
.pay-banner-list .ttp-btn-pay { white-space: nowrap; text-align: center; }
.pay-banner-note { margin: 10px 0 0; font-size: 14px; color: #4b5563; }

.ttp-invoice-list-title {
    font-size: 18px;
    margin: 0 0 10px;
    color: #1f2937;
}

.ttp-invoice-list {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.ttp-invoice-row { border-top: 1px solid #e5e7eb; border-left: 4px solid #f59e0b; }
.ttp-invoice-row:first-child { border-top: none; }
.ttp-invoice-row[data-status="paid"] { border-left-color: #10b981; }
.ttp-invoice-row[data-status="overdue"] { border-left-color: #dc2626; }

.ttp-invoice-row > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 110px 16px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

.ttp-invoice-row > summary::-webkit-details-marker { display: none; }
.ttp-invoice-row > summary:hover { background: #f9fafb; }
.ttp-invoice-row[open] > summary { background: #f9fafb; }

.row-invoice strong { display: block; color: #1f2937; font-size: 15px; font-weight: 600; }
.row-invoice span { color: #6b7280; font-size: 13px; }
.row-amount { font-weight: 700; color: #1f2937; font-size: 16px; text-align: right; }
.row-status { text-align: right; }
.row-chevron { color: #9ca3af; font-size: 20px; line-height: 1; transition: transform 0.2s ease; }
.ttp-invoice-row[open] .row-chevron { transform: rotate(90deg); }

.row-body { padding: 4px 14px 16px; background: #f9fafb; }

.row-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 28px;
    margin: 0 0 12px;
    font-size: 13px;
}

.row-dates dt { color: #6b7280; }
.row-dates dd { margin: 0; font-weight: 500; color: #1f2937; }
.row-dates dd.overdue { color: #dc2626; }
.row-dates dd.paid { color: #10b981; font-weight: 600; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions .ttp-btn { padding: 8px 12px; font-size: 13px; text-align: center; }

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.status-outstanding {
    background: #fef3c7;
    color: #92400e;
}

.ttp-payment-info {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
}

.ttp-payment-info h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.payment-method {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.payment-method h4 {
    margin: 0 0 15px 0;
    color: #1f2937;
}

.payment-method.coming-soon {
    opacity: 0.7;
}

.bank-details {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
}

.bank-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.bank-detail-row:last-child {
    border-bottom: none;
}

.bank-label {
    color: #6b7280;
}

.bank-value {
    color: #1f2937;
    font-weight: 500;
}

.ttp-modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ttp-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.ttp-modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #9ca3af;
}

.ttp-btn-pay {
    background: linear-gradient(135deg, #047857, #065f46);
    color: #ffffff;
    border: none;
    font-weight: 700;
    padding: 10px 14px;
}

.ttp-btn-pay:hover {
    background: linear-gradient(135deg, #065f46, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(4,120,87,0.25);
}

.ttp-btn-pay:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ttp-modal-content h2 {
    margin: 0 0 15px 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1f2937;
}

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.form-actions .ttp-btn {
    flex: 1;
}

@media (max-width: 600px) {
    .pay-banner-list li { grid-template-columns: minmax(0, 1fr) auto; }
    .pay-banner-list .ttp-btn-pay,
    .pay-banner-list .pay-banner-amount { grid-column: 1 / -1; }
    .ttp-invoice-row > summary { grid-template-columns: minmax(0, 1fr) auto 16px; gap: 4px 10px; }
    .row-status { grid-column: 1; grid-row: 2; text-align: left; }
    .row-chevron { grid-column: 3; grid-row: 1; }
    .row-actions .ttp-btn { flex: 1 1 100%; }
}

.invoice-question { margin-top: 12px; }
.invoice-question > summary { list-style: none; cursor: pointer; display: inline-block; }
.invoice-question > summary::-webkit-details-marker { display: none; }
.invoice-question textarea { width: 100%; margin: 10px 0; }
.invoice-asked { margin: 10px 0 0; font-size: 13px; color: #6b7280; }

/* The guest booking wizard (guest-book-appointment.php), unchanged. */

.ttp-booking-progress {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
    padding: 0 20px;
}

.ttp-progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    opacity: 0.5;
}

.ttp-progress-step.active,
.ttp-progress-step.completed {
    opacity: 1;
}

.ttp-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 60%;
    width: 80%;
    height: 2px;
    background: #B9CDD1;
}

.ttp-progress-step.completed:not(:last-child)::after {
    background: #005D6C;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #B9CDD1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
    z-index: 1;
}

.ttp-progress-step.active .step-number {
    background: #005D6C;
}

.ttp-progress-step.completed .step-number {
    background: #10b981;
}

.step-label {
    font-size: 14px;
    color: #3F5C63;
    font-weight: 500;
}

.ttp-appointment-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.ttp-appointment-type-card {
    border: 2px solid #DCE7E9;
    border-radius: 8px;
    padding: 25px;
    position: relative;
    transition: all 0.3s;
    
}

.ttp-appointment-type-card:hover {
    border-color: #005D6C;
    box-shadow: 0 4px 12px rgba(44, 82, 130, 0.1);
}

.ttp-appointment-type-card.recommended {
    border-color: #005D6C;
    background: #f0f4f8;
}

.recommended-badge {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #005D6C;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ttp-appointment-type-card h3 {
    margin: 10px 0 15px 0;
    color: #06272E;
}

.ttp-appointment-type-card .price {
    font-size: 32px;
    font-weight: bold;
    color: #005D6C;
    margin: 10px 0;
}

.ttp-appointment-type-card .duration {
    color: #6E878D;
    margin-bottom: 15px;
    font-size: 14px;
}

.ttp-appointment-type-card p {
    color: #3F5C63;
    margin-bottom: 20px;
    line-height: 1.6;
}

.consultation-requirement {
    margin: 15px 0;
    padding: 12px;
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.ttp-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.ttp-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.select-type-btn {
    width: 100%;
}

/* Calendar Styles */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    max-width: 420px;
    margin: 0 auto;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #DCE7E9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    min-height: 36px;
    padding: 4px 2px;
}

.calendar-day.header {
    font-weight: 600;
    color: #3F5C63;
    cursor: default;
    border: none;
    font-size: 11px;
    padding: 6px 2px;
}

.calendar-day.disabled {
    color: #B9CDD1;
    cursor: not-allowed;
    background: #FBFDFD;
    opacity: 0.5;
}

/* Color-coded availability */
.calendar-day.has-availability {
    background: #e6ffed;
    border-color: #9ae6b4;
    color: #22543d;
}

.calendar-day.has-availability:hover {
    background: #c6f6d5;
    border-color: #68d391;
    transform: scale(1.08);
}

.calendar-day.no-availability {
    background: #fee;
    border-color: #fbb;
    color: #c53030;
    cursor: not-allowed;
    opacity: 0.7;
}

.calendar-day.no-availability:hover {
    background: #fee;
    border-color: #fbb;
    transform: none;
}

.calendar-day.available:hover {
    background: #e8f4f8;
    border-color: #005D6C;
    transform: scale(1.08);
}

.calendar-day.selected {
    background: #005D6C !important;
    color: white !important;
    border-color: #005D6C !important;
    font-weight: 600;
    transform: scale(1.1);
}

/* Calendar legend */
.calendar-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 12px;
    padding: 10px;
    background: #FBFDFD;
    border-radius: 6px;
    font-size: 12px;
    flex-wrap: wrap;
}

.calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calendar-legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid;
}

.calendar-legend-box.available {
    background: #e6ffed;
    border-color: #9ae6b4;
}

.calendar-legend-box.unavailable {
    background: #fee;
    border-color: #fbb;
}

/* Time slots wrapper for better visibility */
#time-slots-container {
    background: #f8fafc;
    border: 2px solid #005D6C;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(44, 82, 130, 0.1);
}

#time-slots-container h3 {
    margin-top: 0;
    color: #06272E;
    font-weight: 600;
    font-size: 17px;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.time-slot {
    padding: 12px;
    border: 2px solid #B9CDD1;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    background: white;
}

.time-slot:hover {
    background: #EAF4F6;
    border-color: #005D6C;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(44, 82, 130, 0.15);
}

.time-slot.selected {
    background: #005D6C;
    color: white;
    border-color: #005D6C;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 82, 130, 0.3);
}

@media (max-width: 640px) {
    .calendar-grid {
        gap: 2px;
    }
    
    .calendar-day {
        font-size: 12px;
        min-height: 32px;
        padding: 2px;
    }
    
    .calendar-day.header {
        font-size: 10px;
        padding: 4px 1px;
    }
    
    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .calendar-legend {
        font-size: 11px;
        gap: 12px;
    }
    
    .ttp-appointment-type-card{
        max-width: 215px;
    }

    .ttp-btn {
    padding: 9px 10px;
    font-size: 12px;
    }
    #current-month-label{
        font-size: 0.8em;
    }

    .time-slot {
    padding: 3px;
    font-size: 11px;
    }
}

/* Added in the rebuild: the calendar's days and times are links, and the form errors. */
a.calendar-day, a.time-slot { text-decoration: none; color: inherit; }
.calendar-controls .ttp-btn-disabled { opacity: .4; pointer-events: none; }
