/**
 * VVUSD Nurse App - Custom Styles
 * Extends the UI Library for health office-specific components
 */

/* ==================== BASE RESET ==================== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: var(--text-primary);
    padding-top: 64px;
    padding-bottom: 80px;
}

/* ==================== START SCREEN ==================== */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #2b6cb0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.start-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-screen-content {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.4s ease;
}

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

.start-screen-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1a365d, #2c5282);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 10px 40px -10px rgba(26, 54, 93, 0.5);
}

.start-screen-logo .logo-icon {
    font-size: 40px;
    font-weight: 700;
    color: white;
}

.start-screen-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a365d;
    margin: 0 0 8px;
}

.start-screen-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0 0 32px;
}

.start-screen-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.start-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-align: left;
}

.start-school-select {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    color: #1a365d;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

.start-school-select:focus {
    outline: none;
    border-color: #2c5282;
    box-shadow: 0 0 0 4px rgba(44, 82, 130, 0.1);
}

.start-school-select:hover {
    border-color: #94a3b8;
}

.start-continue-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #1a365d, #2c5282);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.start-continue-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(26, 54, 93, 0.5);
}

.start-continue-btn:active:not(:disabled) {
    transform: translateY(0);
}

.start-continue-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.start-hint {
    font-size: 13px;
    color: #94a3b8;
    margin: 8px 0 0;
}

/* Loading state */
.start-continue-btn.loading {
    position: relative;
    color: transparent;
}

.start-continue-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== TOP NAVIGATION ==================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    z-index: var(--z-fixed);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
}

.nav-title {
    font-weight: 600;
    font-size: var(--font-size-lg);
    color: var(--brand-primary);
}

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

.school-select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    min-width: 180px;
}

.user-badge {
    width: 36px;
    height: 36px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* ==================== BOTTOM NAVIGATION ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-2);
    z-index: var(--z-fixed);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
    border-radius: var(--radius-md);
    min-width: 64px;
}

.nav-item:hover {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-item .nav-icon {
    width: 28px;
    height: 28px;
    background: none;
    font-size: 1.25rem;
    color: inherit;
}

.nav-item .nav-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4);
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== SCREEN HEADER ==================== */
.screen-header {
    margin-bottom: var(--space-6);
}

.screen-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0 0 var(--space-1) 0;
}

.screen-header p,
.date-display {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin: 0;
}

/* ==================== KPI CARDS ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.kpi-grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 900px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .kpi-grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 500px) {
    .kpi-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.kpi-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.kpi-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.kpi-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.kpi-value.highlight {
    color: var(--color-primary);
}

.kpi-value.alert {
    color: var(--color-danger);
}

.kpi-trend {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-2);
}

.kpi-trend.trend-up {
    color: var(--color-secondary);
}

/* ==================== GLASS CARD ==================== */
.glass-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-4);
}

.glass-card h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-4) 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.card-header h3 {
    margin: 0;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
}

.btn-link:hover {
    text-decoration: underline;
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions-card {
    margin-bottom: var(--space-6);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-5);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    min-height: 100px;
}

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

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

.action-secondary {
    background: var(--gradient-secondary);
    color: white;
}

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

.action-icon {
    font-size: 1.75rem;
    font-weight: bold;
}

.action-label {
    font-size: var(--font-size-base);
    font-weight: 600;
}

/* ==================== RECENT VISITS LIST ==================== */
.recent-visits-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.visit-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.visit-item:hover {
    background: rgba(255, 255, 255, 0.8);
}

.visit-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.student-name {
    font-weight: 600;
    color: var(--text-primary);
}

.visit-grade {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.visit-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.visit-reason {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.visit-status {
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    display: inline-block;
    width: fit-content;
}

.status-returned {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.status-home {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
}

.visit-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-align: right;
}

/* ==================== ALERT CARD ==================== */
.alert-card {
    border-left: 4px solid var(--color-warning);
}

.alert-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.alert-badge {
    background: var(--gradient-warning);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
}

.alert-header h3 {
    margin: 0;
}

/* ==================== PROCEDURE LIST ==================== */
.procedure-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.procedure-item {
    display: grid;
    grid-template-columns: 1fr 1fr 150px auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
}

.procedure-item.due-now {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.procedure-student {
    font-weight: 600;
}

.procedure-type {
    color: var(--text-secondary);
}

.procedure-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.procedure-item.due-now .procedure-time {
    color: var(--color-warning);
    font-weight: 500;
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
    min-height: 44px;
    min-width: 44px;
}

/* Larger touch target for procedure action buttons */
.procedure-item .btn-sm,
.procedure-item .btn-primary,
.procedure-item .btn-outline {
    padding: var(--space-3) var(--space-4);
    min-height: 48px;
    min-width: 80px;
}

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

.btn-outline {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-size-base);
    border-radius: var(--radius-md);
}

.btn-full {
    width: 100%;
}

/* ==================== ENTRY SCREEN ==================== */
.student-search-card {
    margin-bottom: var(--space-6);
}

.search-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: var(--space-3);
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.25rem;
}

.search-input {
    width: 100%;
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-10);
    font-size: var(--font-size-lg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.recent-students {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.recent-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.student-chip {
    padding: var(--space-2) var(--space-3);
    background: rgba(59, 130, 246, 0.1);
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.student-chip:hover {
    background: rgba(59, 130, 246, 0.2);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    margin-top: var(--space-1);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
    background: rgba(59, 130, 246, 0.08);
}

.autocomplete-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.autocomplete-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.autocomplete-name {
    font-weight: 500;
    color: var(--text-primary);
}

.autocomplete-grade {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.autocomplete-alert {
    width: 20px;
    height: 20px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D97706;
    font-weight: bold;
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

.autocomplete-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Selected Student Banner */
.selected-student-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.15));
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.selected-student-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.selected-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.selected-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.selected-name {
    font-weight: 600;
    color: var(--text-primary);
}

.selected-grade {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.clear-selection-btn {
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.clear-selection-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

/* Entry Section */
.entry-section {
    margin-bottom: var(--space-6);
}

.section-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

@media (max-width: 600px) {
    .entry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.entry-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-5);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    min-height: 100px;
    position: relative;
    background: white;
}

.entry-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.entry-sick {
    border-color: rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(59, 130, 246, 0.1));
}

.entry-sick:hover {
    border-color: var(--color-primary);
}

.entry-injury {
    border-color: rgba(245, 158, 11, 0.3);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.1));
}

.entry-injury:hover {
    border-color: var(--color-warning);
}

.entry-meds {
    border-color: rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(139, 92, 246, 0.1));
}

.entry-meds:hover {
    border-color: var(--color-accent);
}

.entry-procedure {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.1));
}

.entry-procedure:hover {
    border-color: var(--color-secondary);
}

.entry-screening {
    border-color: rgba(6, 182, 212, 0.3);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), rgba(6, 182, 212, 0.1));
}

.entry-screening:hover {
    border-color: var(--color-info);
}

.entry-icon {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.entry-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.lvn-badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: var(--gradient-warning);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* Emergency Button */
.emergency-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--gradient-danger);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    cursor: pointer;
    transition: var(--transition-base);
}

.emergency-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.emergency-icon {
    font-size: 1.75rem;
    font-weight: bold;
}

.emergency-label {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: 0.025em;
}

/* ==================== PROCEDURES SCREEN ==================== */
.filter-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-3);
}

.filter-tab {
    padding: var(--space-2) var(--space-4);
    background: none;
    border: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition-fast);
}

.filter-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.filter-tab.active {
    background: var(--color-primary);
    color: white;
}

.procedure-full-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.procedure-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    display: grid;
    gap: var(--space-3);
}

.procedure-card.due-now {
    border-color: var(--color-warning);
    border-width: 2px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.02), rgba(245, 158, 11, 0.05));
}

.procedure-card.completed {
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.02);
}

.procedure-status-badge {
    background: var(--gradient-warning);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    width: fit-content;
}

.procedure-status-badge.completed {
    background: var(--gradient-secondary);
}

.procedure-info h4 {
    margin: 0 0 var(--space-1) 0;
    font-size: var(--font-size-lg);
}

.procedure-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.procedure-alert {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    margin-top: var(--space-2);
}

.procedure-action {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.procedure-type-label {
    font-weight: 600;
    color: var(--text-primary);
}

.procedure-schedule {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.procedure-result {
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    font-weight: 500;
}

.lvn-required-badge {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.completed-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* ==================== REPORTS SCREEN ==================== */
.filter-card {
    margin-bottom: var(--space-4);
}

.filter-row {
    display: flex;
    gap: var(--space-4);
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    font-size: var(--font-size-sm);
    min-width: 120px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table th,
.report-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.report-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-table td {
    font-size: var(--font-size-sm);
}

.report-table td:last-child {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.report-table tr.section-header td {
    background: rgba(0, 0, 0, 0.03);
    font-weight: 600;
    color: var(--text-primary);
    padding-top: var(--space-4);
}

.export-card {
    text-align: center;
}

.export-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== SETTINGS SCREEN ==================== */
.form-group {
    margin-bottom: var(--space-4);
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    background: white;
    transition: var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setting-label {
    font-weight: 500;
    color: var(--text-primary);
}

.setting-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 28px;
    transition: var(--transition-fast);
}

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

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

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

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    padding: var(--space-4);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.modal-close,
.modal-save {
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius);
}

.modal-close {
    color: var(--text-muted);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-save {
    color: var(--color-primary);
    font-weight: 600;
    font-size: var(--font-size-base);
}

.modal-body {
    padding: var(--space-4);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-color);
    background: white;
}

/* Student Banner */
.student-banner {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(59, 130, 246, 0.1));
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.procedure-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.1));
}

.student-avatar {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--font-size-lg);
}

.student-details h3 {
    margin: 0 0 var(--space-1) 0;
    font-size: var(--font-size-lg);
}

.student-details p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Student Alerts */
.student-alerts {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.alert-tag {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.alert-tag.allergy {
    background: rgba(239, 68, 68, 0.15);
    color: #DC2626;
}

.alert-tag.condition {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
}

/* Modal Student Search */
.modal-student-search {
    margin-bottom: var(--space-4);
    position: relative;
}

.modal-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.modal-search-icon {
    position: absolute;
    left: 16px;
    font-size: 18px;
    opacity: 0.5;
}

.modal-search-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-lg);
    background: white;
    transition: all 0.2s ease;
}

.modal-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.modal-search-input::placeholder {
    color: #94a3b8;
}

.modal-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    margin-top: 4px;
}

.modal-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-autocomplete-item:hover,
.modal-autocomplete-item.focused {
    background: #f1f5f9;
}

.modal-autocomplete-item:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-autocomplete-item:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-autocomplete-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.modal-autocomplete-info {
    flex: 1;
    min-width: 0;
}

.modal-autocomplete-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.modal-autocomplete-grade {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-autocomplete-alert {
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.15);
    color: #DC2626;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.modal-autocomplete-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* Student banner with change button */
.student-banner {
    cursor: pointer;
    position: relative;
}

.student-change-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 500;
}

/* Form Sections */
.form-section {
    margin-bottom: var(--space-5);
}

.section-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

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

.section-hint {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

/* Chip Grid */
.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chip {
    padding: var(--space-2) var(--space-4);
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.chip:hover {
    background: rgba(59, 130, 246, 0.1);
}

.chip.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Temperature Input */
.temp-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.temp-input {
    width: 100px;
    font-size: var(--font-size-xl);
    text-align: center;
}

.temp-unit {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}

.temp-quick-btns {
    display: flex;
    gap: var(--space-2);
}

.temp-btn {
    padding: var(--space-2) var(--space-3);
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.temp-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.temp-btn.fever {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.temp-btn.fever:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Disposition */
.disposition-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.disposition-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.disposition-btn:hover {
    border-color: var(--color-primary);
}

.disposition-btn.active {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
}

.disposition-icon {
    font-size: 1.5rem;
}

.disposition-label {
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.mt-2 {
    margin-top: var(--space-2);
}

/* Procedure History */
.procedure-history {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-sm);
}

.history-label {
    color: var(--text-secondary);
}

.history-value {
    font-weight: 600;
    color: var(--text-primary);
}

.history-time {
    color: var(--text-muted);
}

/* Glucose Input */
.glucose-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.glucose-input {
    width: 150px;
    height: 80px;
    font-size: 2.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.glucose-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.glucose-unit {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}

.glucose-range {
    margin-top: var(--space-3);
}

.range-indicator {
    display: flex;
    justify-content: space-between;
}

.range-label {
    font-size: var(--font-size-xs);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.range-label.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.range-label.normal {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-secondary);
}

.range-label.high {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.range-label.very-high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* Vision Input */
.vision-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.vision-input-row span {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
}

.vision-input {
    width: 80px;
    text-align: center;
    font-size: var(--font-size-lg);
}

/* Screening Fields */
.screening-fields {
    margin-bottom: var(--space-4);
}

/* Dose/Carbs Input */
.dose-input-row,
.carbs-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.dose-input,
.carbs-input {
    width: 100px;
    text-align: center;
    font-size: var(--font-size-lg);
}

.dose-unit,
.carbs-unit {
    font-size: var(--font-size-base);
    color: var(--text-muted);
}

/* LVN Required Notice */
.lvn-required-notice {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ==================== EMERGENCY MODAL ==================== */
.modal-emergency {
    background: rgba(127, 29, 29, 0.9);
}

.modal-emergency .modal-content {
    border: 3px solid var(--color-danger);
}

.emergency-header {
    background: var(--gradient-danger);
    color: white;
    border-bottom: none;
}

.emergency-header h2 {
    color: white;
    flex: 1;
    text-align: center;
}

.emergency-header .modal-close {
    color: white;
}

.emergency-content {
    max-width: 700px;
}

.emergency-input {
    border: 2px solid var(--color-danger);
    font-size: var(--font-size-lg);
}

.emergency-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

@media (max-width: 500px) {
    .emergency-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.emergency-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.emergency-type-btn:hover {
    border-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.05);
}

.emergency-type-btn.active {
    border-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
}

.emergency-type-icon {
    font-size: 1.5rem;
    font-weight: bold;
}

.emergency-type-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.emergency-med-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.emergency-med-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.03);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.emergency-med-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.emergency-med-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--color-secondary);
}

.med-icon {
    font-size: 1.25rem;
    font-weight: bold;
}

.med-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* Notification Checklist */
.notification-checklist {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius);
}

.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label {
    flex: 1;
    font-weight: 500;
}

.time-input {
    padding: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
}

.emergency-textarea {
    border: 2px solid var(--color-danger);
}

.emergency-footer {
    flex-direction: column;
    gap: var(--space-3);
}

.btn-emergency {
    background: var(--gradient-danger);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.btn-emergency:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.btn-cancel {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: var(--space-2);
}

.btn-cancel:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: var(--z-tooltip);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    color: var(--color-secondary);
    font-size: 1.25rem;
}

.toast-message {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .top-nav {
        padding: 0 var(--space-3);
    }

    .nav-title {
        display: none;
    }

    .school-select {
        min-width: 140px;
        font-size: var(--font-size-xs);
    }

    .main-content {
        padding: var(--space-3);
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .action-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: var(--space-4);
        min-height: auto;
    }

    .visit-item {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .procedure-item {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .modal-content {
        margin-top: 0;
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }
}
