/* ASCLEPIUS - Advanced Smart Clinical Ledger for Efficient Practice, Intelligent Unified System - Professional Healthcare UI */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Modern Medical Color Palette */
    --primary-blue: #0066CC;
    --primary-blue-dark: #004C99;
    --primary-blue-light: #E6F2FF;
    --accent-teal: #00A896;
    --accent-teal-dark: #007A6C;
    --accent-teal-light: #E0F7F5;
    
    /* Neutral Colors */
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    
    /* Functional Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    
    /* Card Colors for Dashboard */
    --card-blue: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-teal: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --card-orange: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --card-purple: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --card-green: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --card-red: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Transitions */
    --transition: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-blue-light) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* Background Pattern */
.bg-pattern {
    background-image: 
        radial-gradient(circle at 25px 25px, rgba(0, 102, 204, 0.03) 2px, transparent 0),
        radial-gradient(circle at 75px 75px, rgba(0, 168, 150, 0.03) 2px, transparent 0);
    background-size: 100px 100px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ===== NAVIGATION ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%) !important;
    padding: 0.5rem 1rem;
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--accent-teal);
    flex-wrap: nowrap;
}

.navbar-brand {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--white) !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    white-space: nowrap;
    margin-right: 1rem;
}

.navbar-brand i {
    font-size: 1.1rem;
    color: var(--accent-teal-light);
    flex-shrink: 0;
}

.navbar-brand:hover {
    color: var(--accent-teal-light) !important;
}

.navbar .navbar-collapse {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.4rem 0.45rem !important;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.82rem;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white) !important;
    transform: translateY(-1px);
}

.nav-link i {
    margin-right: 0.35rem;
    color: var(--accent-teal-light);
}

.dropdown-menu {
    background: var(--white);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    color: var(--gray-700);
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--primary-blue-light);
    color: var(--primary-blue);
}

.dropdown-item i {
    margin-right: 0.5rem;
    color: var(--primary-blue);
    width: 1.25rem;
}

.dropdown-header {
    color: var(--gray-500);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
}

.dropdown-divider {
    border-color: var(--gray-200);
    margin: 0.5rem 0;
}

/* ===== CONTAINERS ===== */
.container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.container-fluid {
    padding: 1.5rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 1.5rem;
}

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

/* Dashboard Feature Cards */
.feature-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition-slow);
    border: 1px solid var(--gray-100);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-blue);
}

.feature-card .icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.75rem;
    color: var(--white);
}

.feature-card .icon-wrapper.blue { background: var(--card-blue); }
.feature-card .icon-wrapper.teal { background: var(--card-teal); }
.feature-card .icon-wrapper.purple { background: var(--card-purple); }
.feature-card .icon-wrapper.orange { background: var(--card-orange); }
.feature-card .icon-wrapper.green { background: var(--card-green); }
.feature-card .icon-wrapper.red { background: var(--card-red); }

.feature-card h5 {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
}

.feature-card p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.feature-card .btn {
    margin-top: auto;
}

/* Stat Cards */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-blue);
    transition: var(--transition);
}

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

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }
.stat-card.teal { border-left-color: var(--accent-teal); }

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(0, 102, 204, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(0, 102, 204, 0.45);
    background: linear-gradient(135deg, var(--primary-blue-dark) 0%, var(--primary-blue) 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.35);
}

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

.btn-info {
    background: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-teal-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(0, 168, 150, 0.35);
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(0, 168, 150, 0.45);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #D97706 100%);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #DC2626 100%);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.35);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

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

.btn-outline-primary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

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

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8rem;
}

/* ===== FORMS ===== */
.form-control {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--gray-800);
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
    background: var(--white);
    color: var(--gray-800);
}

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

.form-label, label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.section-header {
    background: var(--gray-100);
    color: var(--gray-800);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin: 1.5rem 0 1rem;
    font-weight: 600;
    border-left: 4px solid var(--primary-blue);
}

/* Select2 Styling */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    min-height: 44px;
    padding: 0.25rem;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.select2-dropdown {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-blue);
}

/* ===== TABLES ===== */
.table {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table thead th {
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td {
    padding: 1rem;
    color: var(--gray-700);
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

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

.table-striped tbody tr:nth-of-type(odd) {
    background: var(--gray-50);
}

/* ===== ALERTS ===== */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: #065F46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: #991B1B;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400E;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: #1E40AF;
    border-left: 4px solid var(--info);
}

/* ===== BADGES ===== */
.badge {
    padding: 0.4em 0.75em;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: var(--radius);
}

.badge-primary, .bg-primary {
    background: var(--primary-blue) !important;
}

.badge-success, .bg-success {
    background: var(--success) !important;
}

.badge-warning, .bg-warning {
    background: var(--warning) !important;
    color: var(--white);
}

.badge-danger, .bg-danger {
    background: var(--danger) !important;
}

.badge-info, .bg-info {
    background: var(--accent-teal) !important;
}

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

.modal-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-header .close {
    color: var(--white);
    opacity: 0.8;
}

.modal-header .close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== HERO SECTION ===== */
.hero-section {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 50%, var(--accent-teal-dark) 100%);
    color: var(--white);
    padding: 3rem 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='100' cy='100' r='80' fill='none' stroke='rgba(255,255,255,0.1)' stroke-width='2'/%3E%3Ccircle cx='100' cy='100' r='60' fill='none' stroke='rgba(255,255,255,0.1)' stroke-width='2'/%3E%3Ccircle cx='100' cy='100' r='40' fill='none' stroke='rgba(255,255,255,0.1)' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0.5;
}

.hero-section h1 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.hero-section p {
    opacity: 0.9;
    font-size: 1.1rem;
    margin-bottom: 0;
    position: relative;
}

.hero-section .hero-icon {
    font-size: 4rem;
    opacity: 0.3;
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== QUICK ACTION GRID ===== */
.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
}

.sidebar-header {
    font-weight: 600;
    color: var(--gray-800);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.sidebar-link:hover {
    background: var(--primary-blue-light);
    color: var(--primary-blue);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--primary-blue);
    color: var(--white);
}

.sidebar-link i {
    margin-right: 0.75rem;
    width: 1.25rem;
}

/* ===== WARD MANAGEMENT ===== */
.ward-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 2px solid transparent;
    overflow: hidden;
}

.ward-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-blue);
}

.ward-card-header {
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--white);
}

.ward-card-header.medical { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.ward-card-header.surgical { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.ward-card-header.icu { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.ward-card-header.pediatric { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.ward-card-header.maternity { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.ward-card-body {
    padding: 1.25rem;
}

.bed-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.75rem;
    margin: 2px;
}

.bed-indicator.available { background: var(--success-light); color: var(--success); }
.bed-indicator.occupied { background: var(--danger-light); color: var(--danger); }
.bed-indicator.reserved { background: var(--warning-light); color: var(--warning); }

/* ===== PATIENT CARDS ===== */
.patient-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border-left: 4px solid var(--primary-blue);
    transition: var(--transition);
}

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

.patient-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-blue-light);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--gray-800);
    color: var(--gray-400);
    padding: 1.5rem;
    margin-top: auto;
    text-align: center;
    font-size: 0.875rem;
}

.footer a {
    color: var(--accent-teal-light);
}

/* ===== UTILITIES ===== */
.text-primary { color: var(--primary-blue) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-teal { color: var(--accent-teal) !important; }

.bg-light { background: var(--gray-50) !important; }
.bg-white { background: var(--white) !important; }

.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }

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

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ===== LOADING STATES ===== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== PWA & MOBILE ENHANCEMENTS ===== */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body.standalone-mode {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

@supports (padding: env(safe-area-inset-top)) {
    .navbar {
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
    .footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

input, textarea, select, button {
    font-size: 16px !important;
}

a, button, .btn, .nav-link, .dropdown-item {
    -webkit-tap-highlight-color: transparent;
}

.btn, .nav-link, .dropdown-item, .feature-card, .stat-card {
    touch-action: manipulation;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .navbar-nav {
        padding-top: 1rem;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .quick-action-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-section {
        padding: 2rem 1.5rem;
    }
    
    .hero-section h1 {
        font-size: 1.5rem;
    }
    
    .hero-section .hero-icon {
        display: none;
    }

    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .dropdown-menu {
        background: rgba(255, 255, 255, 0.05) !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 0 0 1rem !important;
    }
    
    .dropdown-item {
        color: rgba(255, 255, 255, 0.85) !important;
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem;
    }
    
    .dropdown-item:hover, .dropdown-item:active {
        background: rgba(255, 255, 255, 0.1) !important;
    }
    
    .dropdown-header {
        color: rgba(255, 255, 255, 0.5) !important;
        font-size: 0.7rem !important;
    }
    
    .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.1) !important;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1.1rem; }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .hero-section {
        padding: 1.5rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.3rem;
    }
    
    .hero-section h4 {
        font-size: 0.9rem;
        letter-spacing: 2px !important;
    }
    
    .stat-card {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .quick-action-card {
        padding: 16px;
        margin-bottom: 10px;
    }
    
    .feature-card {
        padding: 16px;
        margin-bottom: 10px;
    }
    
    .billing-card {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .btn-lg {
        padding: 12px 20px;
        font-size: 16px;
    }

    .modal-dialog {
        margin: 10px;
    }

    .table th, .table td {
        padding: 8px 6px;
        font-size: 13px;
    }
    
    .footer {
        padding: 1rem 0.5rem;
    }
    
    .footer .row {
        text-align: center;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 8px;
        margin: 0.5rem auto;
    }
    
    .btn:not(.btn-sm):not(.btn-group .btn):not(.d-flex .btn):not(.d-inline-flex .btn) {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn {
        width: auto;
    }
    
    .d-flex .btn, .d-inline-flex .btn {
        width: auto;
    }
    
    .card, .section-card {
        border-radius: 8px;
        margin-bottom: 10px;
    }
    
    .security-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
    
    .navbar-brand strong {
        font-size: 0.85rem !important;
    }
    
    .hero-section p {
        font-size: 0.75rem;
    }
    
    .col-md-3, .col-md-4, .col-md-6 {
        padding-left: 6px;
        padding-right: 6px;
    }
    
    .table th, .table td {
        padding: 6px 4px;
        font-size: 12px;
        white-space: nowrap;
    }

    .modal-content {
        border-radius: 12px;
    }
    
    .form-group label {
        font-size: 13px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar, .sidebar, .btn, .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
}

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

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

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

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

/* ===== SECURITY BADGE ===== */
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--success-light);
    color: var(--success);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
}

.security-badge i {
    font-size: 1rem;
}

/* ===== MEDICAL ICONS STYLING ===== */
.medical-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
}

/* Global form control fixes - prevent text cutoff in inputs and selects */
.form-control {
    height: auto !important;
    min-height: 44px;
    padding: 10px 14px !important;
    line-height: 1.5 !important;
    font-size: 14px;
    overflow: visible;
}

select.form-control {
    min-height: 46px;
    padding: 10px 14px !important;
}

.form-control-sm {
    min-height: 38px !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
}

select.form-control-sm {
    min-height: 38px !important;
    padding: 6px 10px !important;
}

.medical-icon.stethoscope { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.medical-icon.hospital { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.medical-icon.patient { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.medical-icon.chart { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.medical-icon.pill { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.medical-icon.clipboard { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
