/* ============================================
   DENTAL OPD — Page-Specific Styles
   ============================================ */

/* ── Dental Chart ── */
.dental-chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
}

.dental-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-6);
}

.dental-arch {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-1);
}

.dental-arch.lower {
    align-items: flex-start;
}

.tooth {
    width: 36px;
    height: 44px;
    border: 2px solid var(--border-strong);
    border-radius: 6px 6px 4px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--surface);
    position: relative;
    user-select: none;
}

.tooth:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
    transform: translateY(-2px);
}

.tooth.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
}

.tooth.caries {
    background: #FEF3C7;
    border-color: var(--warning);
}

.tooth.missing {
    background: var(--bg-alt);
    border-style: dashed;
    color: var(--text-muted);
    opacity: 0.6;
}

.tooth.filled {
    background: #DBEAFE;
    border-color: var(--info);
}

.tooth.rct {
    background: #E0E7FF;
    border-color: #6366F1;
}

.tooth.crown {
    background: #FEE2E2;
    border-color: var(--danger);
}

.tooth.extraction {
    background: var(--danger-bg);
    border-color: var(--danger);
}

.tooth-label {
    position: absolute;
    bottom: -18px;
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.dental-midline {
    width: 2px;
    height: 52px;
    background: var(--border-strong);
    margin: 0 var(--sp-2);
}

.arch-row {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quadrant-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    width: 30px;
    text-align: center;
}

.tooth-legend {
    display: flex;
    gap: var(--sp-4);
    flex-wrap: wrap;
    justify-content: center;
    margin-top: var(--sp-4);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* Condition Panel */
.condition-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
}

.condition-btn {
    padding: var(--sp-1) var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--fs-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.condition-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.condition-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── Queue Board ── */
.queue-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}

.queue-column {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    min-height: 400px;
}

.queue-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 2px solid var(--border);
}

.queue-column-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.queue-count {
    background: var(--border);
    color: var(--text-muted);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
}

.queue-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-3);
    margin-bottom: var(--sp-2);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.queue-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.queue-patient-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text);
}

.queue-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: var(--sp-1);
}

/* ── Calendar ── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calendar-header-cell {
    background: var(--bg);
    padding: var(--sp-2);
    text-align: center;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
}

.calendar-cell {
    background: var(--surface);
    padding: var(--sp-2);
    min-height: 100px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.calendar-cell:hover {
    background: var(--primary-bg);
}

.calendar-date {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    margin-bottom: var(--sp-1);
}

.calendar-cell.today .calendar-date {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-event {
    font-size: 0.6875rem;
    padding: 2px 4px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--primary-bg);
    color: var(--primary);
    border-left: 2px solid var(--primary);
}

/* ── Prescription ── */
.rx-header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}

.rx-symbol {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--primary);
    font-family: serif;
}

.drug-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: var(--sp-3);
    align-items: end;
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
}

/* ── Profile Header ── */
.profile-header {
    display: flex;
    gap: var(--sp-6);
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    margin-bottom: var(--sp-6);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--text);
}

.profile-meta {
    display: flex;
    gap: var(--sp-4);
    margin-top: var(--sp-2);
    flex-wrap: wrap;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

/* ── Consent Signature Area ── */
.signature-pad {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    cursor: crosshair;
    transition: all var(--transition-fast);
}

.signature-pad:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

/* ── Approval Checklist ── */
.approval-check {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) 0;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.approval-check input:checked+span {
    color: var(--success);
}

/* ── Notifications ── */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-4);
    padding: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    margin-bottom: var(--sp-2);
}

.notification-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    z-index: 10;
}

.notification-item.unread {
    background: linear-gradient(to right, rgba(15, 118, 110, 0.04), transparent);
    border-left: 4px solid var(--primary);
}

.notification-item.unread .notification-title {
    color: var(--primary-dark);
    font-weight: var(--fw-bold);
}

.notification-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin-bottom: 2px;
    line-height: 1.3;
}

.notification-message {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 4px;
}

.notification-time {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    margin-top: 4px;
}

/* ── Modern Dashboard Stats ── */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.stat-tile {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    box-shadow: var(--shadow-sm);
}

.stat-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.tile-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-3);
    font-size: var(--fs-lg);
}

.tile-content {
    z-index: 2;
}

.tile-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: var(--sp-1);
}

.tile-value {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    line-height: 1;
}

/* Tile Variations */
.tile-new .tile-icon {
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary);
}

.tile-new:hover {
    background: linear-gradient(135deg, var(--surface), var(--primary-bg));
    border-color: var(--primary-light);
}

.tile-old .tile-icon {
    background: rgba(30, 64, 175, 0.1);
    color: #1E40AF;
}

.tile-old:hover {
    background: linear-gradient(135deg, var(--surface), #DBEAFE);
    border-color: #93C5FD;
}

.tile-gender .tile-icon {
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
}

.tile-gender:hover {
    background: linear-gradient(135deg, var(--surface), #EDE9FE);
    border-color: #C4B5FD;
}

.tile-ref-in .tile-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.tile-ref-in:hover {
    background: linear-gradient(135deg, var(--surface), #FEF3C7);
    border-color: #FCD34D;
}

.tile-ref-out .tile-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.tile-ref-out:hover {
    background: linear-gradient(135deg, var(--surface), #D1FAE5);
    border-color: #6EE7B7;
}

/* ── Charts Grid ── */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

/* ── Reports UI ── */
.report-container {
    animation: fadeIn 0.3s ease-in-out;
}

.report-filters {
    display: flex;
    align-items: center;
    background: var(--surface);
    padding: var(--sp-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.filter-pills {
    display: flex;
    gap: var(--sp-2);
}

.filter-pill {
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    background: var(--bg-alt);
    color: var(--text);
}

.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(15, 118, 110, 0.2);
}

.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
}

.report-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    position: relative;
    overflow: hidden;
}

.report-stat-card .stat-label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    margin-bottom: var(--sp-1);
}

.report-stat-card .stat-value {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--sp-2);
}

.report-stat-card .stat-trend {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
}

.stat-trend.positive {
    color: var(--success);
}

.stat-trend.negative {
    color: var(--danger);
}

.stat-trend.neutral {
    color: var(--text-muted);
}

.report-charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--sp-4);
}

.chart-card.large {
    grid-column: span 1;
}

.chart-header {
    margin-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--sp-2);
}

.chart-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text);
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.chart-header {
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-2);
    border-bottom: 1px dashed var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .notification-item {
        align-items: center;
    }

    .notification-message {
        margin-bottom: 0;
    }

    .notification-time {
        margin-top: 0;
        margin-left: auto;
        padding-left: var(--sp-4);
    }
}