/**
 * Track My Well-Being - Main Stylesheet
 * Mobile-first responsive design with light theme
 */

/* =====================================================
   CSS Variables (Light Theme)
   ===================================================== */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: #eef2ff;

    /* Secondary Colors */
    --secondary: #64748b;
    --secondary-light: #94a3b8;
    --secondary-dark: #475569;

    /* Status Colors */
    --success: #22c55e;
    --success-bg: #dcfce7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #06b6d4;
    --info-bg: #cffafe;

    /* 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;

    /* Background */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Borders */
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

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

    /* Touch targets */
    --touch-target: 44px;

    /* Bottom nav height */
    --bottom-nav-height: 64px;

    /* Safe area */
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* =====================================================
   Base Styles
   ===================================================== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent pull-to-refresh on mobile */
body.no-pull-refresh {
    overscroll-behavior-y: contain;
}

/* Page with bottom nav */
body.has-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

/* =====================================================
   Typography
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.text-muted {
    color: var(--text-secondary) !important;
}

/* =====================================================
   Buttons (Touch-friendly)
   ===================================================== */
.btn {
    min-height: var(--touch-target);
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-lg {
    min-height: 52px;
    padding: 0.875rem 1.5rem;
    font-size: 1.1rem;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-light {
    background-color: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--text-primary);
}

.btn-icon {
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* =====================================================
   Form Controls (Touch-friendly)
   ===================================================== */
.form-control,
.form-select {
    min-height: var(--touch-target);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.875rem;
}

/* Input group for phone */
.input-group-phone .form-select {
    max-width: 110px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-phone .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* OTP Input */
.otp-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.otp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background-color: var(--bg-card);
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

.card-body {
    padding: var(--space-lg);
}

/* =====================================================
   Landing Page
   ===================================================== */
.landing-page {
    min-height: 100vh;
}

.landing-logo {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 3rem;
    box-shadow: var(--shadow-lg);
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background-color: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.feature-text {
    display: flex;
    flex-direction: column;
}

.feature-text strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.feature-text span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* =====================================================
   Auth Pages
   ===================================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-back {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 50%;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
}

.auth-content {
    flex: 1;
    padding: 0 var(--space-lg) var(--space-xl);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

/* =====================================================
   Bottom Navigation
   ===================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 8px;
    padding-bottom: var(--safe-area-bottom);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 4px;
    min-height: var(--touch-target);
    transition: color 0.2s;
}

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

.bottom-nav-item i {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.bottom-nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.bottom-nav-item .badge {
    position: absolute;
    top: 0;
    right: 50%;
    transform: translateX(100%);
    font-size: 0.65rem;
    padding: 2px 5px;
}

.nav-icon-wrapper {
    position: relative;
}

/* =====================================================
   Side Drawer
   ===================================================== */
.offcanvas {
    max-width: 300px;
}

.offcanvas-header {
    background-color: var(--primary);
    color: var(--white);
    padding: var(--space-xl) var(--space-lg);
}

.offcanvas-title {
    font-weight: 600;
}

.drawer-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.drawer-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
}

.drawer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.drawer-menu-item {
    border-bottom: 1px solid var(--border-color);
}

.drawer-menu-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    text-decoration: none;
    min-height: var(--touch-target);
    transition: background-color 0.2s;
}

.drawer-menu-item a:hover,
.drawer-menu-item a:active {
    background-color: var(--gray-100);
}

.drawer-menu-item a i {
    font-size: 1.25rem;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.drawer-menu-item.danger a {
    color: var(--danger);
}

.drawer-menu-item.danger a i {
    color: var(--danger);
}

/* =====================================================
   Page Header
   ===================================================== */
.page-header {
    background-color: var(--white);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =====================================================
   Person Cards
   ===================================================== */
.person-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: var(--space-md);
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
}

.person-card:hover,
.person-card:active {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.person-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 1.25rem;
}

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

.person-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.person-arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* =====================================================
   Empty States
   ===================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background-color: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    font-size: 2rem;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

/* =====================================================
   Notifications
   ===================================================== */
.notification-item {
    display: flex;
    gap: 1rem;
    padding: var(--space-md);
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.notification-item.unread {
    background-color: var(--primary-bg);
}

.notification-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.notification-icon.link-request {
    background-color: var(--info-bg);
    color: var(--info);
}

.notification-icon.approval {
    background-color: var(--success-bg);
    color: var(--success);
}

.notification-icon.reminder {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.notification-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* =====================================================
   QR Code Display
   ===================================================== */
.qr-container {
    text-align: center;
    padding: var(--space-xl);
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
}

.qr-code {
    background-color: var(--white);
    padding: var(--space-lg);
    display: inline-block;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-lg);
}

.qr-code img,
.qr-code canvas {
    display: block;
    max-width: 200px;
    height: auto;
}

.share-code {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.share-code-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* =====================================================
   Ad Spaces
   ===================================================== */
.ad-space {
    background-color: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    position: relative;
}

.ad-space-banner {
    height: 60px;
    width: 100%;
}

.ad-space-rectangle {
    height: 100px;
    width: 100%;
}

.ad-space-square {
    width: 250px;
    height: 250px;
    margin: 0 auto;
}

.ad-label {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Hide ads for premium users */
body.is-premium .ad-space {
    display: none;
}

/* =====================================================
   Alerts & Toasts
   ===================================================== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.alert-success {
    background-color: var(--success-bg);
    color: #166534;
}

.alert-danger {
    background-color: var(--danger-bg);
    color: #991b1b;
}

.alert-warning {
    background-color: var(--warning-bg);
    color: #92400e;
}

.alert-info {
    background-color: var(--info-bg);
    color: #0e7490;
}

/* Toast positioned for mobile */
.toast-container {
    position: fixed;
    top: var(--space-md);
    left: var(--space-md);
    right: var(--space-md);
    z-index: 1100;
}

/* =====================================================
   Modal Adjustments
   ===================================================== */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
}

.modal-header {
    border-bottom-color: var(--border-color);
    padding: var(--space-lg);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    border-top-color: var(--border-color);
    padding: var(--space-md) var(--space-lg);
}

/* Full screen modal on mobile */
@media (max-width: 575.98px) {
    .modal-dialog-mobile-fullscreen {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-dialog-mobile-fullscreen .modal-content {
        height: 100%;
        border-radius: 0;
    }
}

/* =====================================================
   Loader
   ===================================================== */
.loader {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

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

.page-loader {
    position: fixed;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* =====================================================
   Permission Badges
   ===================================================== */
.permission-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.permission-badge.admin {
    background-color: var(--primary-bg);
    color: var(--primary);
}

.permission-badge.edit {
    background-color: var(--success-bg);
    color: var(--success);
}

.permission-badge.view {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

/* =====================================================
   Utility Classes
   ===================================================== */
.touch-target {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
}

.clickable {
    cursor: pointer;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    padding: 0 var(--space-lg);
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: var(--space-md) 0;
}

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

/* =====================================================
   Tablet Adjustments (768px and up)
   ===================================================== */
@media (min-width: 768px) {
    :root {
        --bottom-nav-height: 72px;
    }

    .container {
        max-width: 600px;
    }

    .auth-page .container {
        max-width: 450px;
    }

    .bottom-nav {
        justify-content: center;
        gap: 2rem;
    }

    .bottom-nav-item {
        flex: 0 0 auto;
        padding: 8px 16px;
    }

    .person-card {
        padding: var(--space-lg);
    }

    .qr-code img,
    .qr-code canvas {
        max-width: 250px;
    }
}

/* =====================================================
   Large Tablet / Desktop (992px and up)
   ===================================================== */
@media (min-width: 992px) {
    .container {
        max-width: 700px;
    }

    .landing-page .container {
        max-width: 500px;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .bottom-nav,
    .ad-space,
    .btn,
    .offcanvas {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* =====================================================
   Business Registration - Step Progress
   ===================================================== */
.step-progress {
    height: 4px;
    background-color: var(--gray-200);
    position: relative;
}

.step-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.3s ease;
}

.step-indicator {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: var(--space-sm) 0;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
}

/* =====================================================
   Business Type Cards
   ===================================================== */
.business-type-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.business-type-card {
    display: block;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

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

.business-type-card.selected {
    border-color: var(--primary);
    background-color: var(--primary-bg);
}

.business-type-card.selected .business-type-check {
    display: flex;
}

.business-type-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
}

.business-type-icon.pharmacy {
    background-color: #dcfce7;
    color: #22c55e;
}

.business-type-icon.doctor {
    background-color: #fce7f3;
    color: #ec4899;
}

.business-type-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.business-type-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.business-type-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.business-type-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.business-type-features li i {
    color: var(--success);
    font-size: 0.75rem;
}

.business-type-check {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 24px;
    height: 24px;
    background-color: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

/* Business Type Badge */
.business-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
}

.business-type-badge.pharmacy {
    background-color: #dcfce7;
    color: #22c55e;
}

.business-type-badge.doctor {
    background-color: #fce7f3;
    color: #ec4899;
}

/* =====================================================
   Owner Cards
   ===================================================== */
.owner-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.owner-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.owner-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.owner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.owner-name {
    font-weight: 600;
}

.owner-phone {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.owner-photo-upload {
    padding: var(--space-md);
}

/* =====================================================
   File Upload
   ===================================================== */
.file-upload-box {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--gray-50);
}

.file-upload-box:hover {
    border-color: var(--primary);
    background-color: var(--primary-bg);
}

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

.file-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.file-upload-content i {
    font-size: 2rem;
    color: var(--primary);
}

.file-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.file-preview img {
    max-width: 100px;
    max-height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

.file-preview i {
    font-size: 2.5rem;
}

.file-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
    max-width: 150px;
}

/* Compact file upload */
.file-upload-box.compact {
    padding: var(--space-md);
}

.file-upload-box.compact .file-upload-content i {
    font-size: 1.5rem;
}

.file-preview.compact img {
    max-width: 80px;
    max-height: 80px;
}

/* =====================================================
   Document Upload Card
   ===================================================== */
.document-upload-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* =====================================================
   Address Card
   ===================================================== */
.address-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.address-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.address-card-header h5 {
    margin: 0;
    font-size: 1rem;
}

.address-card-body {
    padding: var(--space-md);
}

/* =====================================================
   Review Section
   ===================================================== */
.review-section {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.review-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.review-section-header h6 {
    margin: 0;
    font-size: 0.9rem;
}

.review-section-body {
    padding: var(--space-md);
}

.review-item {
    margin-bottom: var(--space-sm);
}

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

.review-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-value {
    font-weight: 500;
}

.review-owner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.review-owner-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.review-owner-name {
    font-weight: 500;
}

.review-owner-phone {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.review-document {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
}

.review-address {
    font-size: 0.9rem;
}

.review-photos {
    display: flex;
    gap: var(--space-sm);
}

.review-photo-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

/* =====================================================
   Status Page
   ===================================================== */
.status-container {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
}

.status-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-lg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.status-container.approved .status-icon {
    background-color: var(--success-bg);
    color: var(--success);
}

.status-container.rejected .status-icon,
.status-icon.rejected {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.status-icon.reviewing {
    background-color: var(--primary-bg);
}

.review-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--primary-bg);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.business-summary-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    text-align: center;
}

.review-progress {
    max-width: 300px;
    margin: 0 auto;
}

.review-progress-bar {
    height: 8px;
    background-color: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.review-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.review-progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

/* =====================================================
   Business Dashboard
   ===================================================== */
.business-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.business-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.business-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.business-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.business-icon.pharmacy {
    background-color: #dcfce7;
    color: #22c55e;
}

.business-icon.doctor {
    background-color: #fce7f3;
    color: #ec4899;
}

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

.business-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.business-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.business-arrow {
    color: var(--text-muted);
}

.business-card-body {
    display: flex;
    gap: var(--space-lg);
    padding: 0 var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-md);
}

.business-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.business-stat i {
    color: var(--primary);
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.quick-action-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.quick-action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto var(--space-sm);
    background-color: var(--primary-bg);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.quick-action-card span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* =====================================================
   Business Management
   ===================================================== */
.business-header-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
}

.manage-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.manage-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.manage-section-header h5 {
    margin: 0;
    font-size: 1rem;
}

.manage-section-body {
    padding: var(--space-md);
}

/* Owner List Item */
.owner-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.owner-details {
    flex: 1;
    min-width: 0;
}

/* Address List Item */
.address-list-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    margin: calc(-1 * var(--space-md));
    margin-bottom: 0;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

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

.address-list-item:hover {
    background-color: var(--gray-50);
}

.address-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.address-details {
    flex: 1;
    min-width: 0;
}

.address-line {
    font-weight: 500;
}

.address-city {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.quick-action-card:hover {
    background-color: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-action-card i {
    font-size: 1.5rem;
    color: var(--primary);
}

.quick-action-card span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Address List Item with Quick Actions */
.address-list-item-wrapper {
    border-bottom: 1px solid var(--border-color);
}

.address-list-item-wrapper:last-child {
    border-bottom: none;
}

.address-list-item-wrapper .address-list-item {
    margin: 0;
    border-bottom: none;
}

.address-quick-actions {
    display: flex;
    gap: var(--space-sm);
    padding: 0 var(--space-md) var(--space-md);
    padding-left: calc(40px + var(--space-md) + var(--space-md));
}

.address-quick-actions .btn {
    padding: 0.375rem 0.75rem;
}

/* Document List Item */
.document-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.document-list-item > i {
    font-size: 1.5rem;
}

.document-details {
    flex: 1;
    min-width: 0;
}

.document-type {
    font-weight: 500;
    font-size: 0.9rem;
}

.document-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================================================
   Staff Management
   ===================================================== */
.location-info-card {
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.staff-list-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.staff-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--secondary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.staff-details {
    flex: 1;
    min-width: 0;
}

.staff-name {
    font-weight: 500;
}

.staff-phone {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.staff-permissions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.staff-actions {
    display: flex;
    gap: 0.5rem;
}

.permission-chip {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background-color: var(--gray-100);
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.permission-legend {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.permission-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.permission-item .permission-chip {
    min-width: 70px;
    text-align: center;
}

/* =====================================================
   QR Scanner
   ===================================================== */
.qr-scanner-container {
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
    overflow: hidden;
    min-height: 250px;
}

.qr-scanner-container #qrReader {
    width: 100%;
}

.qr-scanner-container #qrReader video {
    border-radius: var(--border-radius);
}

/* =====================================================
   Join Request Card
   ===================================================== */
.join-request-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.join-request-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.join-request-body {
    padding: var(--space-lg);
}

.join-request-footer {
    padding: var(--space-md) var(--space-lg);
    background-color: var(--gray-50);
    border-top: 1px solid var(--border-color);
}

/* =====================================================
   Pending Request Item
   ===================================================== */
.pending-requests-section {
    background-color: var(--warning-bg);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.pending-request-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

/* =====================================================
   Image Viewer Modal
   ===================================================== */
#imageViewerModal .modal-body {
    background-color: var(--gray-900);
}

#imageViewerModal .modal-body img {
    max-height: 70vh;
    object-fit: contain;
}

/* =====================================================
   QR Code Display
   ===================================================== */
.qr-display-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    margin: 0 auto;
}

.qr-code-wrapper {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-code-wrapper.small {
    padding: var(--space-sm);
}

.qr-code-image {
    width: 100%;
    max-width: 280px;
    height: auto;
}

.qr-clinic-info,
.qr-person-info {
    text-align: center;
}

.qr-instructions {
    text-align: center;
}

.qr-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-900);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.qr-fullscreen.active {
    display: flex;
}

.qr-code-fullscreen {
    max-width: 90vw;
    max-height: 60vh;
}

.person-avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--white);
}

/* =====================================================
   Person Select List (Clinic Check-in)
   ===================================================== */
.person-select-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.person-select-item {
    cursor: pointer;
}

.person-select-item input[type="radio"] {
    display: none;
}

.person-select-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.person-select-item input[type="radio"]:checked + .person-select-content {
    border-color: var(--primary);
    background-color: var(--primary-bg);
}

.person-select-content .person-check {
    display: none;
    color: var(--primary);
    font-size: 1.25rem;
    margin-left: auto;
}

.person-select-item input[type="radio"]:checked + .person-select-content .person-check {
    display: block;
}

.person-info .person-name {
    font-weight: 600;
}

.person-info .person-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* =====================================================
   Patient Card
   ===================================================== */
.patient-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

/* =====================================================
   Share Requests
   ===================================================== */
.share-request-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.share-request-item {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--warning);
}

.share-request-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.doctor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.share-request-type {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.share-request-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.share-request-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.share-request-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background-color: var(--gray-50);
    border-radius: var(--border-radius-sm);
}

/* =====================================================
   Prescription List
   ===================================================== */
.prescription-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.prescription-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s ease;
}

.prescription-item:active {
    transform: scale(0.98);
}

.prescription-info {
    flex: 1;
}

.prescription-code {
    font-weight: 600;
    font-family: monospace;
    font-size: 0.9rem;
}

.prescription-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.prescription-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =====================================================
   Prescription View
   ===================================================== */
.prescription-header-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.clinic-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-card {
    background-color: var(--gray-50);
    border-radius: var(--border-radius-sm);
    padding: var(--space-md);
}

.diagnosis-card {
    background-color: var(--info-bg);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

/* =====================================================
   Medicine View Cards
   ===================================================== */
.medicines-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.medicine-view-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.medicine-view-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.medicine-index {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.medicine-name {
    font-weight: 600;
    flex: 1;
}

.medicine-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.medicine-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.detail-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background-color: var(--gray-100);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.medicine-timing {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    align-items: center;
}

.timing-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.timing-badge.morning {
    background-color: #fef3c7;
    color: #92400e;
}

.timing-badge.afternoon {
    background-color: #dbeafe;
    color: #1e40af;
}

.timing-badge.evening {
    background-color: #ede9fe;
    color: #6d28d9;
}

.timing-badge.night {
    background-color: #1e293b;
    color: #e2e8f0;
}

.food-timing {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: var(--space-sm);
    border-left: 1px solid var(--border-color);
    margin-left: var(--space-xs);
}

.medicine-instructions {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* =====================================================
   Medicine Card (Create Prescription)
   ===================================================== */
.medicine-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
}

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

.medicine-number {
    font-weight: 600;
    color: var(--primary);
}

.timing-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.timing-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background-color: var(--gray-50);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
}

.timing-checkbox input:checked + span {
    color: var(--primary);
    font-weight: 500;
}

/* =====================================================
   Fee Card
   ===================================================== */
.fee-card {
    background-color: var(--gray-50);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

/* =====================================================
   Dispense Cards
   ===================================================== */
.dispense-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.dispense-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.dispense-total {
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.dispense-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.dispense-item.substituted {
    background-color: var(--info-bg);
    margin: 0 calc(-1 * var(--space-md));
    padding: var(--space-xs) var(--space-md);
}

/* =====================================================
   Pharmacy Dispense Page
   ===================================================== */
.pharmacy-info-bar {
    background-color: var(--primary);
    color: var(--white);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
}

.dispense-medicine-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

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

.dispense-medicine-details {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.dispense-fields {
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-md);
}

.billing-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.substitution-fields {
    background-color: var(--warning-bg);
    padding: var(--space-sm);
    border-radius: var(--border-radius-sm);
    margin-top: var(--space-sm);
}

/* =====================================================
   Medicine Doses Page
   ===================================================== */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
}

.date-display {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.date-display input[type="date"] {
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 500;
}

.dose-stats {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.dose-stat {
    text-align: center;
    margin-bottom: var(--space-sm);
}

.dose-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.dose-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.dose-progress-bar {
    height: 100%;
    background-color: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.time-slot-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.time-slot-header {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--gray-50);
    font-weight: 600;
}

.dose-list {
    padding: 0;
}

.dose-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.dose-item:first-child {
    border-top: none;
}

.dose-item.status-taken {
    background-color: var(--success-bg);
}

.dose-item.status-missed {
    background-color: var(--danger-bg);
}

.dose-item.status-skipped {
    background-color: var(--gray-100);
}

.dose-info {
    flex: 1;
}

.dose-medicine {
    font-weight: 600;
    margin-bottom: 2px;
}

.dose-dosage {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dose-food-timing {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.dose-instructions {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

.dose-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

/* =====================================================
   QR Section in Prescription View
   ===================================================== */
.qr-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

/* =====================================================
   QR Scanner
   ===================================================== */
.qr-scanner-container {
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

#qr-reader {
    width: 100%;
}

#qr-reader video {
    border-radius: var(--border-radius);
}

#qr-reader__scan_region {
    background: var(--gray-100);
}

#qr-reader__dashboard {
    padding: var(--space-md) !important;
}

#qr-reader__dashboard_section_csr button {
    background-color: var(--primary) !important;
    border: none !important;
    border-radius: var(--border-radius-sm) !important;
    padding: var(--space-sm) var(--space-md) !important;
}

/* =====================================================
   Access Request States
   ===================================================== */
.access-request-pending,
.access-request-form {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

/* =====================================================
   Empty State Enhancements
   ===================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* =====================================================
   Store Medicine Management
   ===================================================== */
.store-info-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.search-actions-bar {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
}

.medicine-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.medicine-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.medicine-list-item.unavailable {
    opacity: 0.6;
    background-color: var(--gray-50);
}

.medicine-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-sm);
    background-color: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.medicine-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.medicine-thumbnail i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.medicine-details {
    flex: 1;
    min-width: 0;
}

.medicine-details .medicine-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medicine-details .medicine-generic {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medicine-details .medicine-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2px;
}

.medicine-details .medicine-price {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-top: 4px;
}

.medicine-details .medicine-price .price {
    font-weight: 600;
    color: var(--success);
}

.medicine-details .medicine-price .mrp {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.medicine-details .medicine-price .stock {
    font-size: 0.75rem;
    padding: 2px 6px;
    background-color: var(--gray-100);
    border-radius: 4px;
}

.medicine-details .medicine-price .stock.low {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.medicine-actions {
    flex-shrink: 0;
}

/* =====================================================
   Search Results
   ===================================================== */
.search-results-container {
    max-height: 300px;
    overflow-y: auto;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.search-results-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.1s;
}

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

.search-result-item:hover {
    background-color: var(--gray-50);
}

.search-result-image {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background-color: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-image i {
    color: var(--text-muted);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
}

.search-result-generic {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-result-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.search-result-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
}

/* =====================================================
   Divider OR
   ===================================================== */
.divider-or {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
}

.divider-or::before,
.divider-or::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider-or span {
    padding: 0 var(--space-md);
    font-size: 0.9rem;
}

/* =====================================================
   Medicine Preview Card
   ===================================================== */
.medicine-preview-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.medicine-preview-image {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-sm);
    background-color: var(--gray-100);
    overflow: hidden;
    flex-shrink: 0;
}

.medicine-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================================
   Selected Medicine Card
   ===================================================== */
.selected-medicine-card {
    background-color: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

/* =====================================================
   Personal Medicines
   ===================================================== */
.personal-medicines-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.personal-medicine-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.personal-medicine-card.inactive {
    opacity: 0.6;
    background-color: var(--gray-50);
}

.personal-medicine-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.personal-medicine-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.personal-medicine-details .detail-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
}

.personal-medicine-details .detail-item i {
    width: 16px;
    color: var(--text-muted);
}

.personal-medicine-actions {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

/* =====================================================
   Referral Dashboard
   ===================================================== */
.campaign-header-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.campaign-header-card .campaign-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.campaign-header-card .campaign-desc {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

.campaign-dates {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.2);
}

.campaign-dates .days-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.goal-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.goal-card.completed {
    border-color: var(--success);
    background: var(--success-bg);
}

.goal-card.rewarded {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--success-bg) 0%, #d1fae5 100%);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.goal-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.goal-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.goal-reward {
    background: var(--warning-bg);
    color: var(--warning);
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    white-space: nowrap;
}

.goal-card.completed .goal-reward,
.goal-card.rewarded .goal-reward {
    background: var(--success);
    color: white;
}

.goal-progress {
    margin: var(--space-md) 0;
}

.goal-progress-bar {
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.goal-card.completed .goal-progress-fill,
.goal-card.rewarded .goal-progress-fill {
    background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
}

.goal-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
    font-size: 0.875rem;
}

.goal-progress-count {
    font-weight: 600;
}

.goal-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--gray-50);
    border-radius: var(--border-radius-sm);
}

.goal-card.completed .goal-message,
.goal-card.rewarded .goal-message {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.secondary-progress {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    padding-left: var(--space-sm);
    border-left: 2px solid var(--primary-light);
}

.earnings-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.earnings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
}

.earnings-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.earnings-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.earnings-value {
    font-weight: 600;
}

.earnings-value.total {
    font-size: 1.25rem;
    color: var(--success);
}

.tier-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--gray-200);
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Referral History */
.earnings-summary {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white;
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.earnings-amount {
    font-size: 2.5rem;
    font-weight: 700;
}

.earnings-breakdown {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.2);
}

.earnings-breakdown-item {
    text-align: center;
}

.earnings-breakdown-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.earnings-breakdown-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.history-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
}

.history-tab {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-secondary);
}

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

.history-tab .badge {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.reward-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--success);
}

.reward-card.processing {
    border-left-color: var(--warning);
}

.reward-card.paid {
    border-left-color: var(--primary);
}

.reward-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.reward-title {
    font-weight: 600;
}

.reward-amount {
    font-weight: 700;
    color: var(--success);
}

.reward-card.processing .reward-amount {
    color: var(--warning);
}

.reward-card.paid .reward-amount {
    color: var(--primary);
}

.reward-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.referral-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.referral-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.referral-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.referral-avatar.business {
    background: var(--success);
    border-radius: var(--border-radius-sm);
}

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

.referral-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.referral-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.referral-stats {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.referral-stat {
    flex: 1;
    text-align: center;
}

.referral-stat-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.referral-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
