/* ============================================
   CSS VARIABLES & DESIGN SYSTEM
   Referans: AppointmentCalendar Widget
   ============================================ */
:root {
  /* Primary Colors - Blue Palette */
  --blue-900: #0f4f7f;
  --blue-700: #1875bb;
  --blue-500: #56b2e4;

  /* Secondary Colors */
  --gold-500: #f3ac40;
  --green-500: #2DBE7B;
  --green-600: #28a745;
  --green-700: #218838;
  --red-500: #D94A4A;
  --red-600: #dc3545;
  --red-700: #c82333;
  --gray-500: #6c757d;
  --gray-600: #5a6268;

  /* Backgrounds */
  --bg-cream: #f4f8fb;
  --bg-panel: #ffffff;
  --bg-hover: #d0e0ff;
  --bg-selected: #a0c4ff;
  --bg-striped: #f7f7f7;
  --bg-table-hover: #e2e6ea;

  /* Text Colors */
  --text-dark: #0f1f2f;
  --text-muted: #5f6d7b;
  --text-label: #555;

  /* Borders */
  --border-soft: #e3edf7;
  --border-input: rgba(15, 31, 47, 0.08);
  --bridge-edge-color: #4a4a4a;

  /* Treatment Card Palette - soft, eye-friendly stack */
  --card-grad-1-start: #6faee8;
  --card-grad-1-end: #4f8fd5;
  --card-grad-2-start: #8e9df0;
  --card-grad-2-end: #6c7cd8;
  --card-grad-3-start: #75d6d1;
  --card-grad-3-end: #4bb1ab;
  --card-grad-4-start: #8fd1b4;
  --card-grad-4-end: #5ca485;
  --card-grad-5-start: #f3c6a5;
  --card-grad-5-end: #e1a47d;
  --card-grad-6-start: #9cb7f2;
  --card-grad-6-end: #738fd8;

  /* Shadows */
  --shadow-soft: 0 16px 45px rgba(15, 31, 47, 0.08);
  --shadow-sm: 0 4px 12px rgba(15, 31, 47, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 31, 47, 0.15);
  --shadow-button: rgb(139, 139, 139) 1px 1px 2px 0;
  --shadow-button-hover: rgb(100, 100, 100) 2px 2px 4px 0;
  --shadow-selection: 0 0 5px rgba(0, 123, 255, 0.5);

  /* Border Radius */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-xxs: 6px;
  --radius-xxxs: 4px;
  --radius-pill: 999px;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-2xl: 24px;

  /* Typography */
  --font-family: 'Raleway', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-base: 0.2s ease-in-out;
  --transition-slow: 0.3s ease;

  /* Z-index layers */
  --z-base: 1;
  --z-dropdown: 100;
  --z-modal: 1000;
  --z-toast: 2000;
}

@media (max-width: 767.98px) {
  #dental-guarantee {
    margin-top: 0 !important;
  }
}

/* KALDIRILDI: Bu kural artık Bootstrap flex sınıfları ile yönetiliyor.
#dental-guarantee {
    margin-top: 7px;
    margin-left: 2px;
    vertical-align: middle;
}
*/

/* Checked state for Dental Guarantee box */
#dental-guarantee:checked {
    accent-color: var(--blue-700);
}
body, html, input, button, select, textarea, table, th, td, label, .form-control, .btn {
    font-family: var(--font-family) !important;
}
html {
    background-color: var(--bg-panel);
    font-family: var(--font-family);
}
body {
    font-size: var(--font-size-base);
    font-style: normal;
    font-weight: 400;
    background-color: var(--bg-panel);
    scroll-behavior: smooth;
}

body.body-locked {
    overflow: hidden;
}
.main-content {
    padding: 15px;
    margin: auto;
    width: 100%;
    max-width: 960px;
}
#dental-chart {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}
.jaw-wrapper {
    position: relative;
}
.tooth-row {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 2px;
    position: relative; /* Bracket positioning için reference point */
}
.quadrant-labels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    text-align: center;
    gap: 8px;
    align-items: center;
    margin-bottom: 15px;
}
.jaw-wrapper.lower .quadrant-labels {
     margin-bottom: 0;
     margin-top: 15px;
}

/* Jaw/Area selection buttons */
.jaw-area-btn {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    border: 1.5px solid #ccc;
    border-radius: 5px;
    padding: 4px 12px;
    font-weight: bold;
    font-size: var(--font-size-sm);
    color: var(--text-label);
    background: transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    text-align: center;
    white-space: nowrap;
}
.jaw-area-btn:hover {
    background-color: var(--bg-hover);
    border-color: var(--blue-500);
    box-shadow: 0 2px 8px rgba(86,178,228,0.3);
}
.jaw-area-btn:focus-visible {
    outline: 3px solid var(--blue-500);
    outline-offset: 2px;
}
.jaw-area-btn.selected {
    background-color: var(--bg-selected);
    border-color: var(--blue-700);
    color: #fff;
    box-shadow: 0 2px 8px rgba(86,178,228,0.4);
}
.pointer-events-none {
    pointer-events: none;
}
.tooth-container {
    text-align: center;
    cursor: pointer;
    transition: background-color var(--transition-base), outline var(--transition-fast);
    position: relative;
    font-weight: 500;
    border-radius: var(--radius-xxs);
    padding: 2px;
}
.tooth-container:hover {
    background-color: var(--bg-hover);
}
.tooth-container:focus {
    outline: 3px solid var(--blue-500);
    outline-offset: 2px;
}
.tooth-container:focus:not(:focus-visible) {
    outline: none;
}
.tooth-container.selected {
    background-color: var(--bg-selected);
    box-shadow: var(--shadow-selection);
}

@media (hover: none) {
    .tooth-container:hover {
        background-color: transparent;
    }
    .jaw-area-btn:hover:not(.selected) {
        background-color: transparent;
        border-color: #ccc;
        box-shadow: none;
    }
}

/* ============================================
   DENTAL BRIDGE VISUALIZATION - HIGHLIGHT BAND
   Diş numaralarının arkasında renkli bant gösterimi
   ============================================ */

/* Bridge link styling */
.bridge-link {
    color: #1875bb !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    margin-right: 4px;
    transition: color 0.2s ease;
}

.bridge-link:hover {
    color: #145a93 !important;
    text-decoration: underline !important;
}

.tooth-number-text {
    position: relative;
    z-index: 1;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color var(--transition-base);
    font-size: var(--font-size-sm);
}

/* Bridge olan dişlerin numara alanı - turuncu bant */
.tooth-container.has-bridge .tooth-number-text {
    background-color: #FFDAA2;
    font-weight: 600;
    /* Yanyana dişlerle birleşmesi için horizontal genişletme */
    /* Gap 2px + container arası boşluk = toplam ~3px kapatmak gerekiyor */
    margin-left: -3px;
    margin-right: -3px;
    padding-left: 7px;
    padding-right: 7px;
    border-radius: 0; /* Köşeleri kaldır, düz bant görünümü */
}

/* Jaw-specific dark accents - bottom for upper, top for lower */
.tooth-container[data-jaw="upper"].has-bridge .tooth-number-text {
    box-shadow: inset 0 -3px 0 var(--bridge-edge-color);
}

.tooth-container[data-jaw="lower"].has-bridge .tooth-number-text {
    box-shadow: inset 0 3px 0 var(--bridge-edge-color);
}

/* Bridge grubunun ilk dişi - sol köşeler yuvarlatılmış + sol kenar koyu gri */
.tooth-container.bridge-first .tooth-number-text {
    border-radius: 3px 0 0 3px;
    border-left: 3px solid var(--bridge-edge-color); /* Koyu gri sol kenar - ayırıcı */
    padding-left: 5px; /* Border genişliği kadar padding azalt */
}

/* Bridge grubunun son dişi - sağ köşeler yuvarlatılmış + sağ kenar koyu gri */
.tooth-container.bridge-last .tooth-number-text {
    border-radius: 0 3px 3px 0;
    border-right: 3px solid var(--bridge-edge-color); /* Koyu gri sağ kenar - ayırıcı */
    padding-right: 5px; /* Border genişliği kadar padding azalt */
}

/* Tek diş bridge ise (teorik durum) - tüm köşeler yuvarlatılmış + her iki kenar */
.tooth-container.bridge-first.bridge-last .tooth-number-text {
    border-radius: 3px;
    border-left: 3px solid var(--bridge-edge-color);
    border-right: 3px solid var(--bridge-edge-color);
    padding-left: 5px;
    padding-right: 5px;
}
.tooth-image {
    width: 100%;
    height: auto;
    pointer-events: none; 
}

.extraction-overlay {
    position: absolute;
    left: 50%;
    width: 55%;
    max-width: 38px;
    transform: translateX(-50%);
    pointer-events: none;
    display: none;
    z-index: 2;
}

.tooth-container[data-jaw="upper"] .extraction-overlay {
    top: 6%;
    bottom: auto;
}

.tooth-container[data-jaw="lower"] .extraction-overlay {
    top: auto;
    bottom: 6%;
}

/* Implant Crown Overlay - positioned over implant base */
.implant-crown-overlay {
    position: absolute;
    left: 50%;
    width: 100%;
    height: auto;
    transform: translateX(-50%);
    pointer-events: none;
    display: none;
    z-index: 1;
}

.tooth-container[data-jaw="upper"] .implant-crown-overlay {
    top: 0;
    bottom: auto;
}

.tooth-container[data-jaw="lower"] .implant-crown-overlay {
    top: auto;
    bottom: 0;
}

.unselectable {
    -moz-user-select: -moz-none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.grad {
    color: white !important;
    border-radius: var(--radius-xxs) !important;
    box-shadow: var(--shadow-button) !important;
    padding: 8px 20px !important;
    background-color: var(--blue-700) !important;
    border: 1px solid var(--blue-700) !important;
    background-image: linear-gradient(5deg, rgb(20, 95, 155) 0%, rgb(22, 110, 174) 32%, rgb(24, 120, 187) 63%, rgb(26, 128, 193) 100%) !important;
    transition: all var(--transition-base);
}
.grad:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover) !important;
}

.grad-danger {
    color: #fff !important;
    border-radius: var(--radius-xxs) !important;
    box-shadow: var(--shadow-button) !important;
    padding: 8px 20px !important;
    background-color: var(--red-600) !important;
    border: 1px solid var(--red-600) !important;
    background-image: linear-gradient(135deg, var(--red-700), var(--red-600)) !important;
    transition: all var(--transition-base);
}

.grad-danger:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover) !important;
}

.grad-neutral {
    color: var(--text-dark) !important;
    border-radius: var(--radius-xxs) !important;
    box-shadow: var(--shadow-button) !important;
    padding: 8px 20px !important;
    background-color: #f4f6f8 !important;
    background-image: linear-gradient(135deg, #f7f8fa 0%, #e3e6eb 100%) !important;
    border: 1px solid var(--border-soft) !important;
    transition: all var(--transition-base);
}

.grad-neutral:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover) !important;
    background-color: #eef1f5 !important;
    background-image: linear-gradient(135deg, #fdfefe 0%, #e6e9ef 100%) !important;
}
.btn-remove-grad {
    color: white !important;
    border-radius: var(--radius-xxxs) !important;
    box-shadow: var(--shadow-button) !important;
    background-color: var(--red-600) !important;
    border: 1px solid var(--red-600) !important;
    background-image: linear-gradient(135deg, var(--red-700), var(--red-600)) !important;
    padding: .25rem .5rem;
    font-size: .875rem;
    line-height: 1;
    transition: all var(--transition-base);
}
.btn-remove-grad:hover {
     transform: translateY(-2px);
    box-shadow: var(--shadow-button-hover) !important;
}
/* Fixed button width for uniform layout */
#add-to-plan-btn,
#cancel-edit-btn,
#save-plan-btn {
    min-width: 120px;
    width: 120px;
    text-align: center;
}

.footer-tooth-count {
    width: 180px;
    min-width: 180px;
    height: 48px;
    border-radius: var(--radius-md);
    background: #f8f9fd;
    box-shadow: inset 0 0 0 1px rgba(15, 31, 47, 0.08), 0 4px 10px rgba(15, 31, 47, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: var(--font-size-base);
    color: #3a4557;
}

.footer-tooth-count span {
    color: var(--blue-700);
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-left: 6px;
}

.submit-row {
    gap: 12px;
    margin-top: -6px;
}

.button-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.button-row .submit-below,
.button-row .download-btn {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    margin-top: 0;
    border-radius: var(--radius-xs);
    padding: 8px 10px !important;
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.button-row .submit-below i,
.button-row .download-btn i {
    font-size: 12px;
}

.submit-below {
    margin-top: 4px;
    width: 180px;
    min-width: 180px;
    border-radius: var(--radius-md);
}

/* Submit button - same as update button (.grad style) */
#save-plan-btn {
    color: white !important;
    border-radius: var(--radius-xxs) !important;
    box-shadow: var(--shadow-button) !important;
    padding: 8px 20px !important;
    margin-right: 8px;
    background-color: #1878BB !important;
    border: 1px solid #1878BB !important;
    background-image: linear-gradient(135deg, #0f5e99 0%, #1878BB 40%, #49a8ff 100%) !important;
    transition: all var(--transition-base);
    background-size: 150% 150%;
}

#save-plan-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover) !important;
    background-position: 100% 0;
}

#save-plan-btn:disabled {
    background-color: #b3cfe8 !important;
    border: 1px solid #b3cfe8 !important;
    background-image: none !important;
    color: white !important;
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* Ping effect for unsaved changes */
#save-plan-btn.has-changes {
    position: relative;
}

/* Ping dot - visible dot on top right */
#save-plan-btn.has-changes::after {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 10;
}

/* Animated ping ring */
#save-plan-btn.has-changes::before {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    z-index: 9;
    animation: ping-pulse 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    75%, 100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Cancel button styled with gradient/glow like others */
#cancel-edit-btn {
    color: white !important;
    border-radius: var(--radius-xxs) !important;
    box-shadow: var(--shadow-button) !important;
    background-color: var(--gray-500) !important;
    border: 1px solid var(--gray-500) !important;
    background-image: linear-gradient(135deg, var(--gray-600), var(--gray-500)) !important;
    transition: all var(--transition-base);
}
#cancel-edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-button-hover) !important;
}

/* Submit button styling now defined above with corporate blue gradient */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-striped);
}
#treatment-plan-body tr:hover {
    background-color: var(--bg-table-hover);
}
.table thead th {
    text-align: left;
    vertical-align: middle;
}
.treatment-table-wrapper {
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    padding: 18px 0;
    box-shadow: none;
}
.treatment-table-wrapper table {
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-bottom: 0;
}
.treatment-table-wrapper thead th {
    border: none !important;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: transparent;
}
.treatment-table-wrapper tbody tr {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 20px rgba(52, 73, 94, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.treatment-table-wrapper tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(52, 73, 94, 0.12);
}
.treatment-table-wrapper tbody td {
    border: none !important;
    padding: 16px 14px !important;
    vertical-align: middle;
    background: transparent;
}
.treatment-table-wrapper tbody tr td:first-child {
    font-weight: 400;
    color: var(--text-dark);
}
.treatment-table-wrapper tbody tr td:nth-child(2) {
    text-align: center;
    font-weight: 600;
}
.treatment-table-wrapper tbody tr td:nth-child(3) {
    font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    color: var(--text-muted);
}
.treatment-table-wrapper tbody tr td:nth-child(4) {
    text-align: center;
}
.treatment-table-wrapper tbody tr td:nth-child(2) {
    color: var(--blue-700);
    font-weight: 600;
    text-align: center;
}
.treatment-table-wrapper tbody tr td:nth-child(4) {
    color: var(--green-600);
    font-size: var(--font-size-md);
}
.treatment-table-wrapper tbody tr td:nth-child(5),
.treatment-table-wrapper tbody tr td:nth-child(6) {
    color: var(--text-muted);
}
.treatment-table-wrapper tbody tr td:last-child {
    text-align: left;
}

#treatment-plan-body tr {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}
#treatment-plan-body tr {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}
#treatment-plan-body tr:hover {
    background-color: var(--bg-table-hover);
}
.table thead th {
    text-align: left;
    vertical-align: middle;
}
html, body {
    height: 100% !important;
    overflow-y: auto;
}
.main-content {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}
#patient-name, #user-name {
    display: none;
}
label[for="patient-name"], label[for="user-name"] {
    display: none;
}

/* Center the ✔️ icon in the Guarantee column */
#treatment-plan-body td:nth-child(4) {
    text-align: center;
    vertical-align: middle;
}

/* Bridge column - left aligned, vertical middle */
.bridge-cell {
    text-align: left;
    vertical-align: middle;
    padding-left: 8px !important;
}

/* Bridge links with spacing */
.bridge-cell .bridge-link {
    display: inline-block;
    line-height: 1.6;
    font-weight: 600;
    color: var(--blue-700);
}


@media (max-width: 767.98px) {
  .row > .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .row > .col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .col-md-6.d-flex.align-items-end {
    display: flex !important;
    align-items: center !important;
    padding-bottom: 8px;
  }
  
  /* GÜNCELLENDİ: Mobil görünümde dikey hizalama için eklenen dolguyu kaldır. */
  #guarantee-group {
    padding-top: 0;
  }
}

/* Reduce form font size to match tooth numbers */
input.form-control,
select.form-control,
textarea.form-control,
label,
.form-check-label {
    font-size: var(--font-size-sm);
}

/* Adjust checkbox appearance and align vertically */
.form-check-input {
    transform: scale(1.3);
    width: 18px;
    height: 18px;
    margin-right: 8px; /* GÜNCELLENDİ: Kutu ile yazı arasına boşluk ekler */
    /* KALDIRILDI: margin-top artık flexbox ile yönetiliyor, bu dikey hizalamayı bozuyordu. */
    /* margin-top: 8px !important; */
}

/* GÜNCELLENDİ: Bu kural, checkbox'ı ve etiketini dikey olarak ortalamaya yardımcı olur. */
.form-check {
    display: flex;
    align-items: center;
}

/* GÜNCELLENDİ: Bu kural, checkbox'ı yandaki select alanı ile hizalamak için boşluk ekler. */
#guarantee-group {
    padding-top: 26px; /* Yaklaşık olarak label yüksekliği + margin */
}


/* Adjust button font size and compact padding */
#add-to-plan-btn,
#cancel-edit-btn,
#save-plan-btn {
    font-size: var(--font-size-sm);
    padding: 6px 14px !important;
    min-width: 100px;
    width: 100px;
}
@media (max-width: 575.98px) {
  .col-md-6 .form-group label[for="dental-guarantee"] {
    display: block;
    margin-bottom: 4px;
  }

  #dental-guarantee {
    display: inline-block;
    margin-top: 0 !important;
  }

  .col-md-6 .form-group {
    display: block !important;
  }
}


/* Increase spacing between the Dental Guarantee checkbox and its label */
.form-check-input + label.form-check-label {
    margin-left: 6px;
}

/* ============================================
   TOAST NOTIFICATION SYSTEM - CORPORATE STYLE
   Center-positioned, modern design with backdrop
   ============================================ */

/* Backdrop overlay for toast */
.toast-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 12000;
    animation: backdropFadeIn 0.2s ease;
}

.toast-backdrop.fade-out {
    animation: backdropFadeOut 0.2s ease forwards;
}

/* Main toast container - centered */
.toast-notification {
    position: fixed;
    top: 8%;
    left: 50%;
    transform: translate(-50%, 0) scale(0.94);
    background: white;
    color: var(--text-dark);
    padding: 28px 36px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 12001;
    min-width: 420px;
    max-width: 520px;
    animation: toastScaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    font-family: 'Raleway', sans-serif;
}

/* Toast icon container */
.toast-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 4px;
}

/* Toast message text */
.toast-message {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-dark);
}

/* Success style */
.toast-notification.toast-success .toast-icon {
    background: rgba(76, 175, 80, 0.15);
    color: var(--green-500);
}

/* Error style */
.toast-notification.toast-error .toast-icon {
    background: rgba(244, 67, 54, 0.15);
    color: var(--red-500);
}

/* Warning style */
.toast-notification.toast-warning .toast-icon {
    background: rgba(243, 172, 64, 0.15);
    color: var(--gold-500);
}

/* Info style */
.toast-notification.toast-info .toast-icon {
    background: rgba(86, 178, 228, 0.15);
    color: var(--blue-500);
}

.toast-action {
    margin-top: 16px;
    padding: 8px 18px;
    border-radius: var(--radius-xs);
    border: none;
    background: #f2f6fc;
    color: var(--blue-700);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 12px rgba(15, 31, 47, 0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.toast-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 31, 47, 0.18);
}

/* Fade out animation for toast */
.toast-notification.fade-out {
    animation: toastScaleOut 0.2s ease forwards;
}

/* Animations */
@keyframes backdropFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes backdropFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes toastScaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -30%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

@keyframes toastScaleOut {
    from {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20%) scale(0.9);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toast-notification {
        min-width: 320px;
        max-width: 90%;
        padding: 24px 28px;
    }

    .toast-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .toast-message {
        font-size: 15px;
    }
}

/* ============================================
   TOOTH TOOLTIP - Treatment Information on Hover
   Mouse imlecinin yanında görünen tedavi bilgisi
   ============================================ */
.tooth-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    color: #2c3e50;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(15, 31, 47, 0.2), 0 2px 8px rgba(15, 31, 47, 0.1);
    max-width: 320px;
    white-space: pre-line;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    border: 1px solid rgba(86, 178, 228, 0.3);
}

.tooth-tooltip.visible {
    opacity: 1;
}

.tooth-tooltip strong {
    color: #1875bb;
    font-weight: 600;
}

.tooth-tooltip-divider {
    border-bottom: 1px solid rgba(86, 178, 228, 0.25);
    margin: 8px 0;
}

/* ============================================
   TREATMENT SELECTION POPUP - Modern Modal Design
   Diş seçimi sonrası açılan treatment formu
   ============================================ */
.treatment-popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.treatment-popup-backdrop.active {
    display: block;
    opacity: 1;
}

.treatment-popup {
    position: fixed;
    top: 5%;
    left: 50%;
    transform: translate(-50%, 0) scale(0.96);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 80px rgba(15, 31, 47, 0.32);
    z-index: 9999;
    width: 90%;
    max-width: 520px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: none;
}

.treatment-popup.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.treatment-popup-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.treatment-popup-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.treatment-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.treatment-popup-close:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.treatment-popup-body {
    padding: 24px 28px;
    max-height: 70vh;
    overflow-y: auto;
}

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

.treatment-popup-body .form-group:last-child {
    margin-bottom: 0;
}

.treatment-popup-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: var(--font-size-sm);
}

.treatment-popup-body select.form-control,
.treatment-popup-body textarea.form-control {
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-xs);
    padding: 11px 14px;
    font-size: var(--font-size-base);
    line-height: 1.5;
    transition: all var(--transition-fast);
    background-color: #fff;
    vertical-align: middle;
}

.treatment-popup-body select.form-control:focus,
.treatment-popup-body textarea.form-control:focus {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(24, 117, 187, 0.1);
    outline: none;
}

.treatment-popup-body select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231875bb' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
    padding-top: 11px;
    padding-bottom: 11px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: auto;
}

.treatment-popup-body.select-open {
    max-height: none;
    overflow: visible;
}

/* Custom Select Component */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    z-index: 1;
}

.custom-select-wrapper.open {
    z-index: 25;
}

.custom-select-wrapper.disabled {
    pointer-events: none;
}

.custom-select-wrapper.disabled .custom-select-trigger {
    background: #f5f7fb;
    color: var(--text-muted);
    border-color: var(--border-soft);
    cursor: not-allowed;
    opacity: 0.8;
}

.custom-select-wrapper.disabled .custom-select-trigger::after {
    opacity: 0.5;
}

.custom-select-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.custom-select-trigger {
    width: 100%;
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-xs);
    padding: 11px 14px;
    font-size: var(--font-size-base);
    line-height: 1.5;
    background: #fff;
    color: var(--text-dark);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.custom-select-trigger::after {
    content: '';
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231875bb' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 12px;
    background-position: center;
    flex-shrink: 0;
}

.custom-select-trigger.is-placeholder {
    color: var(--text-muted);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(24, 117, 187, 0.1);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xs);
    box-shadow: 0 18px 45px rgba(15, 31, 47, 0.15);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    z-index: 20;
}

.custom-select-wrapper.open .custom-select-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.custom-select-options {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 260px;
    overflow-y: auto;
}

.custom-select-option {
    display: block;
    padding: 10px 16px;
    font-size: var(--font-size-base);
    color: var(--text-dark);
    cursor: pointer;
    outline: none;
    transition: background var(--transition-fast);
}

.custom-select-option:hover,
.custom-select-option:focus {
    background: var(--bg-hover);
}

.custom-select-option.selected {
    color: var(--blue-700);
    font-weight: 600;
}

.custom-select-option.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.treatment-popup-body .selected-teeth-display {
    background: var(--bg-cream);
    padding: 12px 16px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-soft);
    margin-bottom: 20px;
}

.treatment-popup-body .selected-teeth-display strong {
    color: var(--blue-700);
    font-weight: 600;
    margin-right: 8px;
}

.treatment-popup-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: stretch;
    flex-wrap: wrap;
}

.treatment-popup-footer .btn {
    min-width: 96px;
    padding: 8px 14px;
    flex: 1 1 30%;
    text-align: center;
    font-size: var(--font-size-base);
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

#popup-delete-btn {
    display: none;
}

/* Checkbox group in popup - yan yana yerleşim */
.popup-checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.popup-checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Mobil için alt alta */
@media screen and (max-width: 480px) {
    .popup-checkbox-group {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    #dental-chart {
        padding: 0 4px;
        max-width: 100%;
    }

    .tooth-row {
        grid-template-columns: repeat(16, minmax(14px, 1fr));
        gap: 1px;
    }

    .tooth-container {
        padding: 1px;
    }

    .tooth-number-text {
        font-size: 11px;
    }

    .quadrant-labels {
        font-size: 10px;
    }
}

@media screen and (max-width: 520px) {
    .tooth-row {
        grid-template-columns: repeat(16, minmax(12px, 1fr));
    }

    .tooth-number-text {
        font-size: 10px;
    }

    .tooth-image {
        max-width: 34px;
        margin: 0 auto;
    }
}

@media screen and (max-width: 600px) {
    .tooth-container.has-bridge .tooth-number-text {
        margin-left: -1px;
        margin-right: -1px;
        padding-left: 5px;
        padding-right: 5px;
    }

    .tooth-container.bridge-first .tooth-number-text {
        border-left-width: 2px;
    }

    .tooth-container.bridge-last .tooth-number-text {
        border-right-width: 2px;
    }
}

/* ============================================
   PDF CAPTURE MODE - Desktop layout override
   Mobilde capture alırken responsive stilleri bypass et
   ============================================ */
.pdf-capture-mode #dental-chart {
    padding: 10px !important;
    max-width: none !important;
    width: 707px !important; /* 187mm @ 96dpi ≈ 707px */
}

.pdf-capture-mode .tooth-row {
    grid-template-columns: repeat(16, 1fr) !important;
    gap: 2px !important;
}

.pdf-capture-mode .tooth-container {
    padding: 2px !important;
}

.pdf-capture-mode .tooth-number-text {
    font-size: 12px !important;
}

.pdf-capture-mode .quadrant-labels {
    font-size: 11px !important;
}

.pdf-capture-mode .tooth-image {
    max-width: none !important;
}

/* Modern Toggle Switch - Ultra Kompakt */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.25s ease;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--blue-700);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(14px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(24, 117, 187, 0.2);
}

.popup-checkbox-item label {
    margin: 0;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
}

.popup-checkbox-item .toggle-switch {
    flex: 0 0 auto;
    width: 34px;
}

.popup-checkbox-item label:not(.toggle-switch) {
    flex: 1;
}

/* Hide original form when popup is active */
.form-hidden {
    display: none;
}

/* ============================================
   LOADING STATES & SPINNER
   Referans: AppointmentCalendar Widget
   ============================================ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
}

.loading-state p {
    color: var(--text-muted);
    font-size: var(--font-size-md);
    margin: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-soft);
    border-top-color: var(--blue-700);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Small inline spinner for buttons */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 40px 20px;
    text-align: center;
}

.empty-state h3 {
    color: var(--text-dark);
    font-size: var(--font-size-xl);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: var(--font-size-md);
    margin: 0;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Loading overlay for entire widget */
.overlay-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.overlay-loading .spinner {
    width: 50px;
    height: 50px;
    border-width: 5px;
}
/* ============================================
   TREATMENT PLAN CARDS - STACKED DESIGN
   File folder style with hover expansion
   ============================================ */

/* Card Container */
.treatment-cards-container {
    display: flex;
    flex-direction: column;
    padding: 0 8px 0 4px;
    position: relative;
    box-sizing: border-box;
}

.visit-section-header {
    font-size: var(--font-size-lg);
    font-weight: 400;
    color: var(--text-dark);
    margin: 12px 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.visit-section-header:hover {
    opacity: 0.8;
}

.visit-section-header.active {
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}

.visit-section-header.active::before {
    background-color: var(--primary);
    box-shadow: 0 0 6px var(--primary);
}

.visit-section-header:first-child {
    margin-top: 6px;
}

.visit-section-header::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(15, 31, 47, 0.18);
    display: inline-block;
}

.treatment-cards-container.single-visit .visit-section-header {
    display: none;
}

/* Individual Treatment Card - Stacked Style */
.treatment-card {
    background: linear-gradient(315deg, var(--card-grad-1-start) 0%, var(--card-grad-1-end) 100%);
    border-radius: var(--radius-md);
    overflow: visible;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: rgb(139, 139, 139) 1px 1px 2px 0;
    border: none;
    position: relative;
    margin-top: -2px;
    z-index: 1;
}

.treatment-card.visit-first-card {
    margin-top: 0;
}

/* First card - no negative margin */
.treatment-card:first-child {
    margin-top: 0;
    z-index: 1;
}

/* Z-index layering REVERSED - bottom cards on top */
.treatment-card:nth-child(1) { z-index: 1; }
.treatment-card:nth-child(2) { z-index: 2; }
.treatment-card:nth-child(3) { z-index: 3; }
.treatment-card:nth-child(4) { z-index: 4; }
.treatment-card:nth-child(5) { z-index: 5; }
.treatment-card:nth-child(6) { z-index: 6; }
.treatment-card:nth-child(n+7) { z-index: 7; }

/* Hover state - expand and elevate */
.treatment-card:hover {
    z-index: 100;
    transform: translateY(-1px);
    box-shadow: rgb(100, 100, 100) 2px 2px 4px 0;
}

/* Visit filter - passive/filtered cards */
.treatment-card.visit-filtered {
    filter: grayscale(100%) opacity(0.5);
    pointer-events: none;
}

.treatment-card.visit-filtered:hover {
    transform: none;
    box-shadow: rgb(139, 139, 139) 1px 1px 2px 0;
    z-index: inherit;
}

/* Card gradient variations - harmonious professional colors */
.treatment-card:nth-child(6n+1) {
    background: linear-gradient(315deg, var(--card-grad-1-start) 0%, var(--card-grad-1-end) 100%);
}

.treatment-card:nth-child(6n+2) {
    background: linear-gradient(315deg, var(--card-grad-2-start) 0%, var(--card-grad-2-end) 100%);
}

.treatment-card:nth-child(6n+3) {
    background: linear-gradient(315deg, var(--card-grad-3-start) 0%, var(--card-grad-3-end) 100%);
}

.treatment-card:nth-child(6n+4) {
    background: linear-gradient(315deg, var(--card-grad-4-start) 0%, var(--card-grad-4-end) 100%);
}

.treatment-card:nth-child(6n+5) {
    background: linear-gradient(315deg, var(--card-grad-5-start) 0%, var(--card-grad-5-end) 100%);
}

.treatment-card:nth-child(6n+6) {
    background: linear-gradient(315deg, var(--card-grad-6-start) 0%, var(--card-grad-6-end) 100%);
}

/* Card Header - Always Visible */
.treatment-card-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-dark);
    position: relative;
    padding-right: 50px;
}

.treatment-card-header-line {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.treatment-card-header.compact {
    padding: 8px 14px;
    padding-right: 14px;
}

.treatment-card-inline {
    display: flex;
    align-items: center;
    width: 100%;
    font-weight: 500;
    color: #f5f6fb;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.treatment-card-inline .inline-item {
    padding: 0 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.treatment-card-inline .inline-item:first-child {
    border-left: none;
    padding-left: 0;
    justify-content: flex-start;
}

.treatment-card-inline .item-product {
    flex: 0 0 35%;
    max-width: 35%;
    font-weight: 500;
    justify-content: flex-start;
    text-align: left;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Hide scrollbar for webkit browsers but keep functionality */
.treatment-card-inline .item-product::-webkit-scrollbar {
    height: 3px;
}

.treatment-card-inline .item-product::-webkit-scrollbar-track {
    background: transparent;
}

.treatment-card-inline .item-product::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.treatment-card-inline .item-product::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.treatment-card-inline .item-quantity {
    flex: 0 0 15%;
    max-width: 15%;
}

.treatment-card-inline .item-visit {
    flex: 0 0 17.5%;
    max-width: 17.5%;
}

.treatment-card-inline .item-guarantee {
    flex: 0 0 24.5%;
    max-width: 24.5%;
    justify-content: flex-start;
}

.treatment-card-inline .item-notes {
    flex: 0 0 8%;
    max-width: 8%;
    justify-content: flex-end;
    padding-right: 0;
}

.treatment-card-inline .item-notes:empty::after {
    content: '';
}

.treatment-card-inline .note-indicator {
    margin-left: auto;
}

@media (max-width: 640px) {
    .treatment-card-header {
        padding-right: 12px;
    }

    .treatment-card-inline .inline-item {
        font-size: 13px;
        padding: 0 6px;
    }

    .treatment-card-inline .item-notes {
        padding-right: 4px;
    }

    .note-indicator {
        width: 19px;
        height: 19px;
        font-size: 10px;
        flex-shrink: 0;
    }
}

/* Product name - 40% width */
.treatment-card-field.field-product {
    flex: 3 1 30%;
    min-width: 0;
}

.treatment-card-field.field-product .treatment-card-value {
    color: #ffffff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Quantity / Visit / Guarantee - equal split */
.treatment-card-field.field-quantity,
.treatment-card-field.field-visit,
.treatment-card-field.field-guarantee {
    flex: 2 1 20%;
    display: flex;
    align-items: center;
    gap: 6px;
}

.treatment-card-field.field-notes-indicator {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 24px;
}

.treatment-card-field.field-notes-indicator:empty {
    opacity: 0.2;
}

.treatment-card-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.treatment-card-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(17, 24, 39, 0.25);
}

.treatment-card-value {
    color: #ffffff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(17, 24, 39, 0.25);
}

.note-indicator {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(15, 31, 47, 0.25);
}

.treatment-card-separator {
    display: none;
}

/* Card Body - Collapsible Content with lighter background */
.treatment-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
    padding: 0 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.88) 100%);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Expand on hover (desktop only) */
@media (min-width: 641px) {
    .treatment-card:hover .treatment-card-body {
        max-height: 500px;
        opacity: 1;
        padding: 0 20px 16px 20px;
    }
}

/* Keep expanded class for editing state */
.treatment-card.expanded .treatment-card-body {
    max-height: 500px;
    opacity: 1;
    padding: 0 20px 16px 20px;
}

.treatment-card-body-content {
    padding-top: 12px;
    border-top: 1px solid rgba(24, 120, 187, 0.2);
}

.treatment-card-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.6;
}

.treatment-card-row:last-child {
    margin-bottom: 0;
}

.treatment-card-row-label {
    font-weight: 600;
    color: #3a4557;
    min-width: 85px;
    flex-shrink: 0;
}

.treatment-card-row-value {
    color: #4a5568;
    flex: 1;
    word-break: break-word;
}

/* Expand/Collapse Indicator - HIDDEN */
.treatment-card-toggle {
    display: none;
}

.treatment-card-header {
    position: relative;
}

/* Editing State - Keep card expanded */
.treatment-card.editing {
    border: none;
    box-shadow: rgb(80, 80, 80) 2px 2px 6px 0;
    z-index: 101 !important;
    transform: translateY(-1px);
}

.treatment-card.editing .treatment-card-body {
    max-height: 500px;
    opacity: 1;
    padding: 0 20px 16px 20px;
}

/* Bridge Links Styling in Cards */
.treatment-card-row-value .bridge-link {
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: #ffffff;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: pointer;
    margin-right: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.treatment-card-row-value .bridge-link:hover {
    color: #ffffff;
    text-decoration-thickness: 2px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Mobile Optimization */
@media (max-width: 640px) {
    .treatment-card-header {
        padding: 14px 16px;
    }

    .treatment-card-field {
        font-size: var(--font-size-sm);
    }

    /* Mobile: expand via click, not hover */
    .treatment-card.expanded .treatment-card-body {
        max-height: 500px;
        opacity: 1;
        padding: 0 16px 14px 16px;
    }

    .treatment-card-row {
        flex-direction: column;
        gap: 2px;
    }

    .treatment-card-row-label {
        min-width: auto;
    }
}

/* Legacy table styles - hide table when using cards */
.treatment-table-wrapper.using-cards table {
    display: none;
}

.treatment-table-wrapper.using-cards {
    padding: 18px 0;
}

@media (max-width: 640px) {
    .treatment-plan-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .treatment-table-wrapper.mobile-cards {
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .treatment-table-wrapper.mobile-cards table {
        border-spacing: 0;
    }

    .treatment-table-wrapper.mobile-cards thead {
        display: none;
    }

    .treatment-table-wrapper.mobile-cards tbody tr {
        display: block;
        margin-bottom: 14px;
        border-radius: 16px;
        background: #f5f7fc;
        padding: 14px 15px;
        box-shadow: 0 6px 18px rgba(23, 52, 91, 0.16);
        line-height: 1.8;
        border: 1px solid rgba(23, 52, 91, 0.08);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .treatment-table-wrapper.mobile-cards tbody tr:last-child {
        margin-bottom: 0;
    }

    .treatment-table-wrapper.mobile-cards tbody tr:hover {
        box-shadow: 0 10px 24px rgba(23, 52, 91, 0.22);
        transform: translateY(-2px);
    }

    .treatment-table-wrapper.mobile-cards tbody td {
        display: block;
        border: none !important;
        padding: 4px 0 !important;
        background: transparent;
        font-size: 13px;
        color: #4a5568;
        align-items: center;
    }

    .treatment-table-wrapper.mobile-cards tbody td::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #2f3a4a;
        margin-right: 6px;
    }

    .treatment-table-wrapper.mobile-cards tbody td span {
        color: #4a5568;
        font-weight: 400;
    }

    .treatment-table-wrapper.mobile-cards tbody td.quantity-value span {
        color: #6b7280;
        font-weight: 400;
    }

    .treatment-table-wrapper.mobile-cards tbody td:last-child {
        display: block;
        margin-top: 2px;
        text-align: left;
    }

    .treatment-table-wrapper.mobile-cards tbody td a {
        color: var(--blue-700);
        text-decoration: underline;
        font-weight: 600;
    }

    .treatment-table-wrapper.mobile-cards tbody tr td.inline-field {
        display: inline-flex;
        padding-right: 10px !important;
        margin-right: 10px;
        align-items: center;
    }

    .treatment-table-wrapper.mobile-cards tbody tr td.inline-field::after {
        content: '|';
        color: rgba(47, 58, 74, 0.35);
        margin-left: 10px;
    }

.treatment-table-wrapper.mobile-cards tbody tr td.inline-field.inline-end::after {
        content: '';
    }
}

.chart-disabled {
    opacity: 0.35;
    filter: grayscale(0.5);
    transition: opacity 0.2s ease;
}

.preflight-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.preflight-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.preflight-spinner {
    width: 50px;
    height: 50px;
    border-width: 5px;
}

#preflight-message {
    color: var(--text-muted);
    margin-top: 0;
}

.preflight-hidden {
    visibility: hidden;
}

.preflight-content.error #preflight-message {
    color: var(--red-500);
}

.preflight-overlay.hidden {
    display: none;
}

/* Print button styles removed - now using inline Download button */

/* ============================================
   PRINT TEMPLATE STYLES - A4 PDF Tasarım
   Consultation Treatment Plan
   ============================================ */

/* CSS Variables for Print Template */
.print-template {
    --page-width: 21cm;
    --page-height: 29.7cm;
    --content-width: 18.7cm;
    --side-margin: 1.15cm;
    --header-height: 4cm;
    --teeth-box-height: 7.1cm;
    --card-height: 3cm;
    --card-inner-height: 1.7cm;
    --gap-teeth-to-inner: 0.8cm;
    --footer-height: 1cm;
    --check-icon-size: 1.4cm;
    --check-area-width: 1.7cm;

    font-family: 'Raleway', Arial, sans-serif;
    color: #0f1f2f;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-template * {
    -webkit-print-color-adjust: inherit;
    print-color-adjust: inherit;
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Page Container */
.print-page {
    width: var(--page-width);
    min-height: var(--page-height);
    margin: 0 auto;
    padding: 0;
    background: #ffffff;
    position: relative;
    box-sizing: border-box;
}

/* Content Container - Centered */
.print-body {
    width: var(--content-width);
    margin: 0 auto;
    padding-top: 0.5cm;
    padding-bottom: calc(var(--footer-height) + 0.5cm);
    box-sizing: border-box;
}

/* ============================================
   HEADER - 4cm height
   ============================================ */
.print-header-fixed {
    width: var(--content-width);
    height: var(--header-height);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: 0.3cm;
}

.print-top-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 0.25cm;
    margin-bottom: 0.2cm;
    border-bottom: 2px solid #dfe8f4;
}

/* Logo block - 4.5cm width */
.print-brand {
    width: 4.5cm;
    flex-shrink: 0;
}

.print-logo {
    height: auto;
    width: 100%;
    max-width: 4.5cm;
    object-fit: contain;
}

/* Title block - 8cm width, right aligned */
.print-plan {
    width: 8cm;
    text-align: right;
    flex-shrink: 0;
}

.print-plan-title {
    font-size: 16px;
    font-weight: 700;
    color: #1875bb;
    margin-bottom: 0.15cm;
}

.print-plan-number {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #1c7dc8, #45b0ff);
    padding: 0.15cm 0.4cm;
    color: #fff;
    border-radius: 0.2cm;
    font-weight: 600;
    font-size: 11px;
    width: 70%;
    box-sizing: border-box;
    margin-left: auto;
}

/* Patient / Created by row */
.print-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5cm;
    margin-top: 0.3cm;
    margin-bottom: 0.3cm;
}

.print-meta-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.15cm;
    font-size: 13px;
    white-space: nowrap;
}

.print-meta-label {
    font-weight: 700;
    color: #0f1f2f;
}

.print-meta-value {
    color: #5f6d7b;
    font-weight: 400;
    display: inline-flex;
    gap: 0.1cm;
    align-items: center;
}

.print-meta-divider {
    margin: 0 0.1cm;
    color: #9aa6b6;
}

/* Divider line after Patient/Created by row */
.print-divider {
    width: 100%;
    height: 2px;
    background-color: #dfe8f4;
    margin-top: 0.2cm;
}

/* ============================================
   DENTAL CHART BOX - 18.7cm × 7.1cm
   ============================================ */
.print-chart-card {
    width: var(--content-width);
    height: var(--teeth-box-height);
    border-radius: 0.25cm;
    border: 1px solid #e1e9f5;
    padding: 0.3cm;
    background: #ffffff;
    margin: 0 auto 0.3cm auto;
    page-break-after: avoid;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.print-dental-chart {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.print-dental-chart img {
    max-width: 92%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ============================================
   VISIT TITLE - 14px
   ============================================ */
.print-visit-header {
    font-size: 16px;
    font-weight: 700;
    color: #1875bb;
    margin-top: 0.2cm;
    margin-bottom: 0.2cm;
    border-bottom: none;
    padding-bottom: 0;
}

.print-visit-section {
    page-break-inside: avoid;
}

.print-treatment-details {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================
   TREATMENT CARD - 18.7cm × 3cm
   ============================================ */
.print-product-card {
    width: var(--content-width);
    height: var(--card-height);
    border-radius: 0.3cm;
    border: 1px solid #d5dde8;
    background: #fff;
    margin-bottom: 0.2cm;
    position: relative;
    page-break-inside: avoid;
    box-sizing: border-box;
    overflow: hidden;
}

/* Last card - no bottom margin */
.print-treatment-details .print-product-card:last-child {
    margin-bottom: 0;
}

.print-product-card.first-product {
    page-break-before: avoid;
}

/* ============================================
   CHECK ICON - 1.4cm in 1.7cm left area
   ============================================ */
.print-product-checkmark {
    position: absolute;
    left: 0.15cm;
    top: 0.6cm;
    width: var(--check-icon-size);
    height: var(--check-icon-size);
}

.print-product-checkmark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ============================================
   CARD HEADER - Fixed column widths
   Left padding: 1.7cm (for check icon area)
   Columns: 5cm (name) + 2cm (qty) + 6.2cm (user) + 2.9cm (guarantee)
   ============================================ */
.print-product-header {
    padding-top: 0.3cm;
    padding-left: var(--check-area-width);
    padding-right: 0.3cm;
    display: flex;
    align-items: center;
    font-size: 11px;
    height: auto;
}

.print-col-name {
    width: 6.5cm;
    flex-shrink: 0;
}

.print-col-quantity {
    width: 2cm;
    flex-shrink: 0;
}

.print-col-user {
    width: 6.2cm;
    flex-shrink: 0;
}

.print-col-guarantee {
    width: 2.9cm;
    flex-shrink: 0;
    text-align: right;
}

.print-treatment-name {
    font-size: 13px;
    font-weight: 700;
    color: #4a5568;
}

.print-quantity-label,
.print-user-label {
    font-weight: 700;
    color: #4a5568;
}

.print-quantity-value,
.print-user-value {
    font-weight: 400;
    color: #4a5568;
}

.print-guarantee-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #1875bb;
}

/* ============================================
   CARD INNER PANEL - 2cm height
   ============================================ */
.print-card-inner {
    height: var(--card-inner-height);
    background: #f3f8ff;
    border-radius: 0.2cm;
    padding: 0.25cm 0.4cm;
    margin: 0.15cm 0.3cm 0.15cm var(--check-area-width);
    font-size: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1cm;
    overflow: hidden;
}

.print-card-inner p {
    margin: 0;
    line-height: 1.4;
}

.print-field-label {
    font-weight: 700;
    color: #5a6778;
    text-transform: uppercase;
}

.print-field-value {
    font-weight: 400;
    color: #0f1f2f;
}

/* Hide elements that are not in new design */
.print-product-main,
.print-product-body,
.print-product-note,
.print-product-dot,
.print-product-name-line,
.print-product-inline-label,
.print-product-inline-value,
.print-product-body-item,
.print-badge,
.print-badge-guarantee,
.print-detail-label,
.print-detail-value {
    display: none !important;
}

/* ============================================
   FOOTER - 1cm height, 21cm width
   ============================================ */
.print-footer-fixed {
    position: absolute;
    left: 0;
    bottom: 0;
    width: var(--page-width);
    height: var(--footer-height);
    background: #1875bb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.3px;
    border-radius: 0;
}

.print-footer-text {
    display: block;
}

/* ============================================
   PAGE BREAK
   ============================================ */
.print-page-break {
    page-break-before: always;
}

.print-page-break-before {
    page-break-before: always;
}

/* Visit continuation header */
.print-continuation-header {
    font-size: 14px;
    font-weight: 600;
    color: #1875bb;
    margin-bottom: 0.2cm;
    padding-bottom: 0;
}

/* Visit-specific dental chart */
.print-visit-chart {
    width: var(--content-width);
    height: var(--teeth-box-height);
    margin-bottom: 0.3cm;
    border-radius: 0.25cm;
    border: 1px solid #e1e9f5;
    overflow: hidden;
}

.print-visit-chart img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ============================================
   PRINT MEDIA QUERIES
   ============================================ */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    /* Force exact A4 dimensions */
    html, body {
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    /* Force color printing */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body * {
        visibility: hidden;
    }

    #print-template,
    #print-template * {
        visibility: visible;
    }

    #print-template {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm !important;
        display: block !important;
    }

    /* Cancel any responsive limits from screen CSS */
    .main-content, .container, .container-fluid {
        max-width: none !important;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        display: none !important;
    }

    /* Page container - exact A4 size */
    .print-page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        position: relative !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        page-break-after: always !important;
    }

    /* Last page should not force page break after */
    .print-page:last-child {
        page-break-after: auto !important;
    }

    /* Content area - 18.7cm centered */
    .print-body {
        width: 187mm !important;
        margin: 0 auto !important;
        padding-top: 5mm !important;
        padding-bottom: 15mm !important; /* Space for footer */
    }

    /* Header - inside content area */
    .print-header-fixed {
        width: 187mm !important;
        position: relative !important;
        margin: 0 auto !important;
    }

    /* Dental chart */
    .print-chart-card {
        width: 187mm !important;
        height: 71mm !important;
        margin: 0 auto 3mm auto !important;
    }

    /* Treatment cards */
    .print-product-card {
        width: 187mm !important;
        height: 30mm !important;
        margin-bottom: 2mm !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* Last card in treatment details - no bottom margin */
    .print-treatment-details .print-product-card:last-child {
        margin-bottom: 0 !important;
    }

    .print-card-inner {
        height: 17mm !important;
    }

    /* Footer - absolute positioned at page bottom */
    .print-footer-fixed {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 210mm !important;
        height: 10mm !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    /* Page breaks */
    .print-page-break,
    .print-page-break-before {
        page-break-before: always !important;
    }

    .print-dental-chart img {
        image-rendering: -webkit-optimize-contrast;
    }

    /* Font sizes - override any responsive changes */
    .print-plan-title {
        font-size: 16px !important;
    }

    .print-plan-number {
        font-size: 11px !important;
    }

    .print-meta-inline {
        font-size: 13px !important;
    }

    .print-visit-header {
        font-size: 16px !important;
    }

    .print-treatment-name {
        font-size: 13px !important;
    }

    .print-product-header {
        font-size: 10px !important;
    }

    .print-card-inner {
        font-size: 9px !important;
    }

    .print-footer-fixed {
        font-size: 10px !important;
    }
}

/* Screen view for print template */
@media screen {
    .print-template {
        display: none;
    }

    /* When print-template is visible for PDF capture */
    .print-template[style*="display: block"] {
        display: block !important;
    }

    .print-template[style*="display: block"] .print-page {
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        position: relative !important;
        overflow: hidden !important;
        box-shadow: none !important;
    }

    .print-template[style*="display: block"] .print-body {
        width: 187mm !important;
        margin: 0 auto !important;
        padding-top: 5mm !important;
        padding-bottom: 15mm !important;
    }

    .print-template[style*="display: block"] .print-header-fixed {
        width: 187mm !important;
        margin: 0 auto !important;
    }

    .print-template[style*="display: block"] .print-chart-card {
        width: 187mm !important;
        height: 71mm !important;
        margin: 0 auto 3mm auto !important;
    }

    .print-template[style*="display: block"] .print-product-card {
        width: 187mm !important;
        height: 30mm !important;
        margin-bottom: 2mm !important;
    }

    .print-template[style*="display: block"] .print-treatment-details .print-product-card:last-child {
        margin-bottom: 0 !important;
    }

    .print-template[style*="display: block"] .print-card-inner {
        height: 17mm !important;
    }

    .print-template[style*="display: block"] .print-footer-fixed {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 210mm !important;
        height: 10mm !important;
    }
}
