/* 
 * Dental Chart Application - Modern Minimal Design v22.3.0
 * Healthcare Blue Theme
 * Author: Dental Value Plan Team
 */

/* ===== CSS Variables - Healthcare Blue Theme ===== */
:root {
    /* Primary Colors - Healthcare Blue */
    --primary: #0085b1;
    --primary-dark: #006a8e;
    --primary-darker: #005270;
    --primary-light: #4db3d4;
    --primary-lighter: #d4eef7;
    --primary-bg: #e8f6fa;
    
    /* Secondary Colors - Light Blue */
    --secondary: #0099cc;
    --secondary-dark: #007aa3;
    --secondary-light: #66c2e0;
    --secondary-lighter: #e0f5fc;
    
    /* Neutral Colors */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Semantic Colors */
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Typography */
    --font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgb(13 148 136 / 0.15);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-bg) 50%, var(--gray-100) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: var(--font-size-2xl);
    color: var(--gray-800);
}

h3 {
    font-size: var(--font-size-xl);
    color: var(--gray-700);
}

p {
    color: var(--gray-600);
    line-height: 1.7;
}

/* ===== Container & Layout ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* ===== Header ===== */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    background: linear-gradient(to bottom, white 0%, var(--gray-50) 100%);
    border-radius: var(--radius-2xl);
    margin-bottom: var(--space-8);
    text-align: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary-light));
}

header img {
    max-height: 80px;
    transition: var(--transition-base);
    filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.1));
}

header img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 8px 12px rgb(13 148 136 / 0.2));
}

/* ===== Sections / Cards ===== */
.section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    position: relative;
}

.section:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--gray-100);
}

.section-title h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--primary-dark);
    font-size: var(--font-size-xl);
}

.section-title h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
}

.section-actions {
    display: flex;
    gap: var(--space-3);
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: var(--space-5);
    position: relative;
}

.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    transition: var(--transition-fast);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: var(--transition-base);
    outline: none;
}

.form-control:hover {
    border-color: var(--gray-300);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-lighter);
}

.form-control::placeholder {
    color: var(--gray-400);
}

/* Patient & Hotel Info Grid */
.patient-info,
.hotel-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

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

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px 0 rgb(13 148 136 / 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    box-shadow: 0 6px 20px 0 rgb(13 148 136 / 0.45);
    transform: translateY(-2px);
}

/* Secondary Button */
.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
    box-shadow: 0 4px 14px 0 rgb(16 185 129 / 0.35);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgb(16 185 129 / 0.45);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    box-shadow: 0 4px 14px 0 rgb(239 68 68 / 0.35);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgb(239 68 68 / 0.45);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-base);
}

.btn-group {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Button Icon */
.btn-icon {
    display: inline-flex;
    font-size: 1.1em;
}

/* ===== Dental Chart ===== */
.dental-chart {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.jaw-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: var(--space-6);
}

.jaw {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    position: relative;
    padding: var(--space-8) 0;
}

.jaw-separator {
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gray-200), var(--primary-light), var(--gray-200), transparent);
    margin: var(--space-2) 0;
}

/* Jaw Labels */
.upper-jaw::before {
    content: 'UPPER JAW';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lower-jaw::after {
    content: 'LOWER JAW';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tooth Styling */
.tooth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: var(--space-2);
    padding: 0;
    width: 64px;
    height: 85px;
    position: relative;
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-base);
}

.tooth::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: transparent;
    border-radius: var(--radius-xl);
    transition: var(--transition-base);
    z-index: 0;
}

.tooth:hover::before {
    background: var(--primary-lighter);
}

.tooth:hover {
    transform: scale(1.1) translateY(-4px);
}

.tooth img {
    width: 52px;
    height: auto;
    max-height: 58px;
    object-fit: contain;
    transition: var(--transition-base);
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgb(0 0 0 / 0.1));
}

.tooth:hover img {
    filter: drop-shadow(0 8px 16px rgb(13 148 136 / 0.25));
}

.tooth.selected::before {
    background: linear-gradient(135deg, var(--primary-lighter), var(--secondary-lighter));
    box-shadow: var(--shadow-glow);
}

.tooth-number {
    position: absolute;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 2px 8px;
    border-radius: var(--radius-full);
    z-index: 2;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.tooth:hover .tooth-number {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.upper-jaw .tooth {
    flex-direction: column-reverse;
}

.upper-jaw .tooth .tooth-number {
    top: -8px;
}

.lower-jaw .tooth {
    flex-direction: column;
}

.lower-jaw .tooth .tooth-number {
    bottom: -8px;
}

/* Treatment Overlay */
.treatment-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    object-fit: contain;
    pointer-events: none;
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.2));
    transition: var(--transition-base);
}

.tooth:hover .treatment-overlay {
    transform: translate(-50%, -50%) scale(1.15);
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn var(--transition-base);
}

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

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    width: 800px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-slow);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--gray-100);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-full);
    font-size: 20px;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition-base);
}

.close-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 2px solid var(--gray-100);
}

/* ===== Steps / Wizard ===== */
.steps-container {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    padding: var(--space-3);
    background: var(--gray-100);
    border-radius: var(--radius-xl);
}

.step {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    text-align: center;
    background: white;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    border: 2px solid transparent;
    transition: var(--transition-base);
    position: relative;
}

.step:hover {
    background: var(--primary-lighter);
    color: var(--primary-dark);
}

.step.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.step.completed {
    background: var(--secondary-lighter);
    color: var(--secondary-dark);
}

.step.completed::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--secondary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.treatment-step {
    display: none;
    animation: fadeSlideIn var(--transition-slow);
}

.treatment-step.active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Radio & Checkbox Groups ===== */
.checkbox-group,
.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.radio-group.horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
}

.checkbox-item:hover,
.radio-item:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}

.checkbox-item:has(input:checked),
.radio-item:has(input:checked) {
    background: var(--primary-lighter);
    border-color: var(--primary);
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: var(--space-3);
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-item label,
.radio-item label {
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    transition: var(--transition-fast);
}

.checkbox-item:has(input:checked) label,
.radio-item:has(input:checked) label {
    color: var(--primary-dark);
    font-weight: 500;
}

/* ===== Tables ===== */
.treatment-table,
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.treatment-table th,
.table th {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 500;
    font-size: var(--font-size-sm);
    text-align: left;
    padding: var(--space-4) var(--space-5);
    letter-spacing: 0.025em;
}

.treatment-table td,
.table td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-size: var(--font-size-sm);
}

.treatment-table tbody tr,
.table tbody tr {
    transition: var(--transition-fast);
}

.treatment-table tbody tr:hover,
.table tbody tr:hover {
    background: var(--primary-bg);
}

.treatment-table tbody tr:nth-child(even),
.table tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.treatment-table tbody tr:nth-child(even):hover,
.table tbody tr:nth-child(even):hover {
    background: var(--primary-bg);
}

.price-column {
    text-align: right;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--primary-dark);
}

.discount-column {
    text-align: center;
    color: var(--danger);
    font-weight: 600;
}

.treatment-total-row {
    background: linear-gradient(135deg, var(--primary-lighter), var(--secondary-lighter)) !important;
    font-weight: 600;
}

.treatment-total-row td {
    border-top: 2px solid var(--primary);
    color: var(--gray-900);
}

/* ===== Summary Section ===== */
.summary-container {
    background: linear-gradient(135deg, var(--primary-lighter), var(--secondary-lighter));
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-top: var(--space-6);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid rgb(13 148 136 / 0.15);
}

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

.summary-label {
    font-weight: 500;
    color: var(--gray-700);
}

.summary-value {
    font-weight: 600;
    color: var(--primary-dark);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.summary-total {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 2px solid var(--primary);
}

.summary-total .summary-label {
    font-size: var(--font-size-lg);
    color: var(--gray-900);
}

.summary-total .summary-value {
    font-size: var(--font-size-2xl);
    color: var(--primary);
}

/* ===== Toggle Switch ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    transition: var(--transition-base);
}

.slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: var(--radius-full);
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

input:checked + .slider::before {
    transform: translateX(28px);
}

input:focus + .slider {
    box-shadow: 0 0 0 4px var(--primary-lighter);
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.toggle-switch label {
    font-weight: 500;
    color: var(--gray-700);
}

.toggle-status {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-500);
}

/* ===== Visit Toggle Section ===== */
.visit-toggle-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin: var(--space-5) 0;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.visit-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--gray-100);
}

.visit-toggle-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-dark);
    margin: 0;
}

.visit-content {
    display: none;
    animation: expandDown var(--transition-slow);
}

.visit-content.active {
    display: block;
}

@keyframes expandDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* ===== Treatment Categories ===== */
.treatment-category {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    border: 1px solid var(--gray-200);
}

.treatment-category h2 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: var(--space-4);
}

/* ===== Selected Plans List ===== */
.selected-plans-list {
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-top: var(--space-4);
    border: 1px solid var(--primary-light);
    max-height: 200px;
    overflow-y: auto;
}

.plan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3);
    background: white;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    border: 1px solid var(--gray-200);
    transition: var(--transition-fast);
}

.plan-item:last-child {
    margin-bottom: 0;
}

.plan-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.remove-plan {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition-base);
}

.remove-plan:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

/* ===== Teeth Selection Grid ===== */
.teeth-grid {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
}

.teeth-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

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

.tooth-cell {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    transition: var(--transition-base);
    user-select: none;
}

.tooth-cell:hover {
    background: var(--primary-lighter);
    border-color: var(--primary);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tooth-cell.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary-dark);
    color: white;
    box-shadow: 0 4px 12px rgb(13 148 136 / 0.4);
    transform: scale(1.05);
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-6);
    justify-content: flex-end;
}

.action-buttons .btn {
    min-width: 140px;
}

/* ===== Treatment Actions ===== */
.treatment-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.btn-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--info-light);
    color: var(--info);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-edit:hover {
    background: var(--info);
    color: white;
}

.btn-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
}

/* ===== Version Info ===== */
.version-info {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

/* ===== Error Messages ===== */
.error-message {
    color: var(--danger);
    font-size: var(--font-size-sm);
    margin-top: var(--space-2);
    display: none;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== Chart Legend ===== */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding: var(--space-5);
    background: var(--gray-50);
    border-radius: var(--radius-xl);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: white;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-xs);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    border: 2px solid white;
    box-shadow: var(--shadow-xs);
}

/* ===== Price Container ===== */
.price-container {
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-top: var(--space-4);
    border: 1px solid var(--primary-light);
}

.price-container-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: var(--space-4);
}

/* ===== Visit Tabs ===== */
.visit-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: var(--space-2);
}

.visit-tab {
    padding: var(--space-3) var(--space-6);
    background: white;
    border: 2px solid var(--gray-200);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-600);
    transition: var(--transition-base);
    position: relative;
    top: 2px;
}

.visit-tab:hover {
    background: var(--primary-lighter);
    color: var(--primary-dark);
}

.visit-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
}

/* ===== Inline Fields ===== */
.inline-fields {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.inline-fields .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* ===== Forms Container ===== */
.forms-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ===== Gingivectomy ===== */
.gingivectomy-types {
    margin-bottom: var(--space-5);
}

.gingivectomy-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-4);
}

.gingivectomy-option {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: var(--transition-base);
}

.gingivectomy-option:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.highlight-new {
    animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
    0% { background-color: var(--primary-lighter); }
    100% { background-color: transparent; }
}

/* ===== Responsive Design ===== */
@media screen and (max-width: 768px) {
    .container {
        padding: var(--space-4);
    }
    
    header {
        padding: var(--space-5);
    }
    
    header img {
        max-height: 60px;
    }
    
    h1 {
        font-size: var(--font-size-2xl);
    }
    
    .section {
        padding: var(--space-5);
    }
    
    .patient-info,
    .hotel-info {
        grid-template-columns: 1fr;
    }
    
    .tooth {
        width: 52px;
        height: 70px;
        margin: var(--space-1);
    }
    
    .tooth img {
        width: 42px;
        max-height: 48px;
    }
    
    .tooth-number {
        font-size: 10px;
        padding: 1px 6px;
    }
    
    .treatment-overlay {
        width: 24px;
        height: 24px;
    }
    
    .modal-content {
        width: 98%;
        padding: var(--space-5);
        border-radius: var(--radius-xl);
    }
    
    .steps-container {
        flex-direction: column;
    }
    
    .checkbox-group,
    .radio-group {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .summary-row {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
    }
    
    .summary-value {
        align-self: flex-end;
    }
    
    .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .section-actions {
        width: 100%;
    }
    
    .inline-fields {
        flex-direction: column;
    }
    
    .tooth-cell {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-xs);
    }
    
    .visit-tabs {
        flex-direction: column;
    }
    
    .visit-tab {
        border-radius: var(--radius-lg);
        border: 2px solid var(--gray-200);
    }
}

/* ===== Print Styles ===== */
@media print {
    body {
        background: white;
    }
    
    .btn,
    .action-buttons,
    .version-info,
    .section-actions {
        display: none !important;
    }
    
    .section {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        break-inside: avoid;
    }
}

/* ===== Focus Visible ===== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
    background: var(--primary-lighter);
    color: var(--primary-darker);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Language & Currency Selectors ===== */
.selectors-container {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-6);
    margin-top: var(--space-4);
    flex-wrap: wrap;
    padding: var(--space-4);
    background: linear-gradient(135deg, var(--gray-50), var(--primary-bg));
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

#languageSelector,
#currencySelector {
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: white;
    font-family: inherit;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition-base);
    appearance: none;
    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='%230d9488' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    min-width: 140px;
}

#languageSelector:hover,
#currencySelector:hover {
    border-color: var(--primary-light);
}

#languageSelector:focus,
#currencySelector:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-lighter);
    outline: none;
}

#languageSelector option,
#currencySelector option {
    padding: var(--space-2);
    font-size: var(--font-size-sm);
}

/* Selector labels */
.selectors-container label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
}

@media screen and (max-width: 768px) {
    .selectors-container {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .selectors-container > div {
        width: 100%;
        justify-content: space-between;
    }
    
    #languageSelector,
    #currencySelector {
        flex: 1;
        min-width: 0;
    }
}
