/* ASSIDU Platform - Global Styles */

/* ============================================
   CSS VARIABLES & DESIGN TOKENS
   ============================================ */

:root {
    /* ============================================
       FIGMA DESIGN TOKENS - ASSIDU Platform
       ============================================ */

    /* Primary Colors - From Figma */
    --primary-color: #175AA6;
    --primary-dark: #124a8a;
    --primary-light: #D7EDFF;
    --secondary-color: #696969;

    /* Status Colors */
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;

    /* Neutral Colors - From Figma */
    --white: #FFFFFF;
    --light-bg: #FFFFFF;
    --gray-50: #F1F1F1;
    --gray-100: #F1F1F1;
    --gray-200: #EBEBEB;
    --gray-300: #D2D2D2;
    --gray-400: #C3C3C3;
    --gray-500: #AFAFAF;
    --gray-600: #696969;
    --gray-700: #606060;
    --gray-800: #474747;
    --gray-900: #3B3B3B;

    /* Text Colors - From Figma */
    --text-dark: #000000;
    --text-muted: #696969;
    --text-light: #AFAFAF;
    --text-disabled: #BDBDBD;
    --text-label: #666666;
    --text-logout: #ACACAC;

    /* Border Colors - From Figma */
    --border-color: #C3C3C3;
    --border-light: #EBEBEB;
    --border-divider: #D2D2D2;

    /* Background Colors - From Figma */
    --bg-selected: #D7EDFF;
    --bg-card: #F1F1F1;
    --bg-dark: #474747;
    --bg-darker: #3B3B3B;

    /* Shadows - From Figma */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 1px 4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.18);

    /* Border Radius - From Figma */
    --radius-sm: 4px;
    --radius-md: 10px;
    --radius-lg: 10px;
    --radius-xl: 10px;
    --radius-pill: 50px;
    --radius-circle: 140px;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Typography - From Figma (Inter Font) */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 22px;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Line Height */
    --line-height-base: 1.21;

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

/* ============================================
   GLOBAL RESETS & BASE STYLES
   ============================================ */

* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-dark);
    background-color: var(--light-bg);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-base);
    margin-top: 0;
    margin-bottom: 1rem;
}

h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
}

h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

h4 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
}

h5 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}

h6 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

strong {
    font-weight: 600;
}

/* ============================================
   PAGE LAYOUT & CONTAINERS
   ============================================ */

.main-content {
    background: var(--light-bg);
    min-height: calc(100vh - 60px);
    padding: var(--spacing-xl);
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

.white-content-area {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   PAGE HEADER BAR COMPONENT
   ============================================ */

.page-header-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 1.25rem 2rem;
    margin-bottom: var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-bar .header-left {
    flex: 1;
    min-width: 0;
}

.page-header-bar .page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.2;
}

.page-header-bar .page-subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.page-header-bar .header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ============================================
   BREADCRUMB NAVIGATION
   ============================================ */

.breadcrumb-nav {
    background: transparent;
    padding: 0;
    margin-bottom: var(--spacing-lg);
    font-size: 0.9rem;
}

.breadcrumb-nav .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    list-style: none;
}

.breadcrumb-nav .breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 0.5rem;
    color: var(--gray-400);
}

.breadcrumb-nav .breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-base);
}

.breadcrumb-nav .breadcrumb-item a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-nav .breadcrumb-item.active {
    color: var(--text-dark);
    font-weight: 500;
}

/* ============================================
   CONTENT TABS NAVIGATION
   ============================================ */

.content-tabs {
    border-bottom: 2px solid var(--border-light);
    margin-bottom: var(--spacing-xl);
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.content-tabs .nav-tabs {
    border-bottom: none;
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.content-tabs .nav-item {
    margin-bottom: 0;
}

.content-tabs .nav-link {
    padding: 0.875rem 1.5rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    top: 2px;
}

.content-tabs .nav-link:hover {
    color: var(--primary-color);
    background-color: var(--gray-50);
    border-bottom-color: var(--gray-300);
}

.content-tabs .nav-link.active {
    color: var(--primary-color);
    background: transparent;
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.content-tabs .tab-content {
    padding-top: var(--spacing-lg);
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

.card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: var(--gray-50);
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
}

/* Patient Card Component */
.patient-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all var(--transition-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.patient-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.patient-card .patient-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.patient-card .patient-info {
    flex: 1;
    min-width: 0;
}

.patient-card .patient-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.patient-card .patient-details {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.patient-card .patient-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Case Card Component */
.case-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all var(--transition-base);
    cursor: pointer;
}

.case-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.case-card .case-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.case-card .case-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.case-card .case-id {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.case-card .case-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.case-card .case-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.case-card .case-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   PHOTO GRID & PHOTO CARDS
   ============================================ */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: var(--spacing-lg);
}

.photo-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}

.photo-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--primary-light);
}

.photo-card .photo-wrapper {
    position: relative;
    padding-top: 75%; /* 4:3 aspect ratio */
    background: var(--gray-100);
    overflow: hidden;
}

.photo-card .photo-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.photo-card:hover .photo-wrapper img {
    transform: scale(1.05);
}

.photo-card .photo-label {
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    background: var(--white);
    border-top: 1px solid var(--border-light);
}

.photo-card .photo-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.25rem;
}

.photo-card .photo-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.photo-card:hover .photo-actions {
    opacity: 1;
}

.photo-card .photo-actions button {
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-base);
}

.photo-card .photo-actions button:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* ============================================
   UPLOAD ZONE
   ============================================ */

.upload-zone {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-2xl);
    text-align: center;
    background: var(--white);
    transition: all var(--transition-base);
    cursor: pointer;
    min-height: 97px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
    border-style: dashed;
}

.upload-zone .upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-zone .upload-text {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-zone .upload-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.upload-zone input[type="file"] {
    display: none;
}

/* Upload Progress */
.upload-progress {
    margin-top: 1rem;
    width: 100%;
    max-width: 400px;
}

.upload-progress .progress {
    height: 8px;
    border-radius: var(--radius-sm);
    background: var(--gray-200);
    overflow: hidden;
}

.upload-progress .progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width var(--transition-base);
}

/* ============================================
   FORM SECTIONS
   ============================================ */

.form-section {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: var(--spacing-lg);
}

.form-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}

.form-section .section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.form-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.form-section .section-body {
    display: grid;
    gap: 1.25rem;
}

.form-section .section-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form Grid Layouts */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

.form-label {
    font-family: var(--font-family);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

.form-label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-family);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-base);
    color: var(--gray-700);
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.15);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--gray-100);
    opacity: 0.7;
    cursor: not-allowed;
}

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

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox and Radio */
.form-check {
    display: flex;
    align-items: center;
    padding-left: 0;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
}

.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.15);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-label {
    cursor: pointer;
    margin-bottom: 0;
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    background-color: var(--gray-100);
    border: 1px solid var(--border-color);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

/* Form Validation */
.invalid-feedback {
    display: none;
    font-size: 0.875rem;
    color: var(--danger-color);
    margin-top: 0.25rem;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

.is-invalid {
    border-color: var(--danger-color);
}

.is-invalid:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.validation-summary-errors {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.validation-summary-errors li {
    color: #991b1b;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-family: var(--font-family);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    text-decoration: none;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button */
.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

/* Secondary Button */
.btn-secondary {
    background-color: var(--gray-600);
    color: var(--white);
    border-color: var(--gray-600);
}

.btn-secondary:hover {
    background-color: var(--gray-700);
    border-color: var(--gray-700);
    color: var(--white);
}

/* Success Button */
.btn-success {
    background-color: var(--success-color);
    color: var(--white);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: var(--white);
}

/* Danger Button */
.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: var(--white);
}

/* Outline Buttons */
.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-outline-secondary {
    border: 2px solid var(--gray-400);
    color: var(--gray-700);
    background-color: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--gray-600);
    border-color: var(--gray-600);
    color: var(--white);
}

/* Light Button */
.btn-light {
    background-color: var(--gray-100);
    color: var(--text-dark);
    border-color: var(--gray-200);
}

.btn-light:hover {
    background-color: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--text-dark);
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1.125rem;
}

/* Icon Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
}

/* Pill Button - From Figma Design */
.btn-pill {
    border-radius: var(--radius-pill);
    padding: 0.5rem 1.5rem;
}

/* Button Groups */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

/* ============================================
   TOOTH CHART STYLING
   ============================================ */

.tooth-chart {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.tooth-chart .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}

.tooth-chart .chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.tooth-chart .chart-legend {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.tooth-chart .legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tooth-chart .legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.tooth-chart .chart-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tooth-chart .tooth-item {
    aspect-ratio: 1;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.75rem;
    font-weight: 600;
    position: relative;
}

.tooth-chart .tooth-item:hover {
    border-color: var(--primary-color);
    background: var(--gray-50);
    transform: scale(1.05);
}

.tooth-chart .tooth-item.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.tooth-chart .tooth-item.issue {
    background: #fef2f2;
    border-color: var(--danger-color);
}

.tooth-chart .tooth-item.treated {
    background: #f0fdf4;
    border-color: var(--success-color);
}

.tooth-chart .tooth-number {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================
   TABLES
   ============================================ */

.table-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-dark);
    border-collapse: collapse;
}

.table thead th {
    background-color: var(--gray-50);
    border-bottom: 2px solid var(--border-light);
    font-weight: 600;
    color: var(--text-dark);
    padding: 1rem;
    text-align: left;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr {
    transition: background-color var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: var(--gray-50);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Responsive Table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   BADGES & STATUS INDICATORS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: var(--radius-md);
    white-space: nowrap;
}

.badge-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.badge-success {
    background-color: var(--success-color);
    color: var(--white);
}

.badge-warning {
    background-color: var(--warning-color);
    color: var(--gray-900);
}

.badge-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.badge-info {
    background-color: var(--info-color);
    color: var(--white);
}

.badge-secondary {
    background-color: var(--gray-500);
    color: var(--white);
}

.badge-light {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--border-color);
}

/* Status Dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.active {
    background-color: var(--success-color);
}

.status-dot.pending {
    background-color: var(--warning-color);
}

.status-dot.inactive {
    background-color: var(--gray-400);
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    border: 1px solid transparent;
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-dismissible {
    padding-right: 3rem;
    position: relative;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
}

/* ============================================
   MODALS & DIALOGS
   ============================================ */

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.5rem;
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.page-item {
    margin: 0;
}

.page-link {
    padding: 0.5rem 0.75rem;
    color: var(--text-dark);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.page-link:hover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */

.dropdown-menu {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 200px;
}

.dropdown-item {
    padding: 0.625rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   TOOLTIPS & POPOVERS
   ============================================ */

.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--gray-900);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
}

/* ============================================
   PROGRESS BARS
   ============================================ */

.progress {
    height: 1rem;
    background-color: var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.progress-bar {
    background-color: var(--primary-color);
    height: 100%;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 500;
}

.progress-bar-success {
    background-color: var(--success-color);
}

.progress-bar-warning {
    background-color: var(--warning-color);
}

.progress-bar-danger {
    background-color: var(--danger-color);
}

/* ============================================
   SPINNERS & LOADING STATES
   ============================================ */

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    background: var(--white);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Text Colors */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--gray-600) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-dark { color: var(--text-dark) !important; }
.text-white { color: var(--white) !important; }

/* Background Colors */
.bg-primary { background-color: var(--primary-color) !important; }
.bg-light { background-color: var(--light-bg) !important; }
.bg-white { background-color: var(--white) !important; }
.bg-gray-50 { background-color: var(--gray-50) !important; }

/* Shadows */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Border Radius */
.rounded { border-radius: var(--radius-md) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-circle { border-radius: 50% !important; }

/* Borders */
.border { border: 1px solid var(--border-color) !important; }
.border-top { border-top: 1px solid var(--border-color) !important; }
.border-bottom { border-bottom: 1px solid var(--border-color) !important; }
.border-left { border-left: 1px solid var(--border-color) !important; }
.border-right { border-right: 1px solid var(--border-color) !important; }
.border-0 { border: 0 !important; }

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-grid { display: grid !important; }

/* Flex Utilities */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Font Weight */
.fw-normal { font-weight: 400 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }

/* Width */
.w-100 { width: 100% !important; }
.w-75 { width: 75% !important; }
.w-50 { width: 50% !important; }
.w-25 { width: 25% !important; }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
    .page-header-bar {
        padding: 1rem 1.5rem;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .tooth-chart .chart-grid {
        gap: 0.375rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .main-content {
        padding: 1rem;
    }

    .white-content-area {
        padding: 1rem;
    }

    .page-header-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .page-header-bar .page-title {
        font-size: 1.5rem;
    }

    .page-header-bar .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .breadcrumb-nav {
        font-size: 0.8rem;
    }

    .content-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    .form-section {
        padding: 1rem;
    }

    .form-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tooth-chart {
        padding: 1rem;
        overflow-x: auto;
    }

    .tooth-chart .chart-grid {
        min-width: 600px;
    }

    .tooth-chart .chart-legend {
        flex-wrap: wrap;
    }

    .table {
        font-size: 0.875rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.5rem;
    }

    .patient-card {
        padding: 1rem;
    }

    .patient-card .patient-details {
        flex-direction: column;
        gap: 0.5rem;
    }

    .case-card .case-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* Desktop: > 1024px */
@media (min-width: 1025px) {
    .content-wrapper {
        max-width: 1600px;
    }

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

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: var(--white);
    }

    .sidebar-wrapper,
    .sidebar-toggle,
    .btn,
    .page-header-bar,
    .breadcrumb-nav,
    .content-tabs {
        display: none !important;
    }

    .main-content-wrapper {
        margin-left: 0 !important;
    }

    .card,
    .white-content-area {
        box-shadow: none !important;
        border: 1px solid var(--border-color) !important;
        page-break-inside: avoid;
    }

    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: var(--text-muted);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

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

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

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

/* ============================================
   SETTINGS PAGE SPECIFIC STYLES
   ============================================ */

/* Settings Tab Navigation */
.nav-tabs {
    border-bottom: 2px solid var(--border-light);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.875rem 1.5rem;
    transition: all var(--transition-base);
}

.nav-tabs .nav-link:hover {
    border-color: var(--gray-300);
    color: var(--text-dark);
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

/* Settings Tables - Mobile Responsive */
@media (max-width: 768px) {
    .table-responsive table {
        min-width: 600px;
    }

    /* Stack action buttons vertically on mobile */
    .table tbody td form.d-inline {
        display: block !important;
        margin-bottom: 0.25rem;
    }

    .table tbody td .btn-sm {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    /* Reduce badge size on mobile */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Status Badge Icons */
.badge i {
    font-size: 0.85em;
    margin-right: 0.25rem;
}

/* Settings Form Inputs - Better mobile layout */
@media (max-width: 768px) {
    .row.mb-4 .col-md-6,
    .row.mb-4 .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* Modal Improvements for Mobile */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-dialog.modal-lg {
        max-width: 100%;
    }
}

/* Table Action Buttons Layout */
.table .text-end .btn-sm {
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.table .text-end .btn-sm:last-child {
    margin-right: 0;
}

/* Empty State Icons */
.text-center i.bi {
    display: inline-block;
}

/* Form validation improvements */
.text-danger {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Input group button styling */
.input-group .btn-outline-secondary {
    white-space: nowrap;
}

/* ============================================
   CUSTOM SCROLLBAR (Webkit browsers)
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-md);
}

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