/* Force light mode - override system dark mode */
html {
    color-scheme: light only;
}

/* Force light theme on all elements */
*, *::before, *::after {
    color-scheme: light !important;
}


/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Universal font consistency */
*, *::before, *::after {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

:root {
    --primary-orange: #30b5ed;
    --primary-orange-light: #85d3f4;
    --primary-orange-dark: #1a84b0;
    --secondary-gray: #6B7280;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --background: #f6fcff;
    --surface: #FFFFFF;
    --surface-light: #F9FAFB;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --success: #10B981;
    --success-light: #D1FAE5;
    --error: #EF4444;
    --error-light: #FEE2E2;
    --warning: #F59E0B;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 32px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* App Container */
.app-container {
    min-height: 100vh;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Centered Layout */
.centered-layout {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Step Container */
.step-container {
    display: none;
    width: 100%;
}

.step-container.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    position: relative;
}

/* Header Section */
.header-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.header-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin: 0 auto 8px auto;
    box-shadow: var(--shadow-lg);
}

.header-logo {
    width: 60%;
    height: auto;
    max-width: 400px;
    min-width: 200px;
    margin: 0 auto 16px auto;
    object-fit: contain;
}

.main-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.main-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    width: 100%;
    padding: 0 24px;
}

.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    transition: all 0.3s ease;
    z-index: 20;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.step-dot.active {
    background: var(--primary-orange);
    color: white;
    box-shadow:
        0 0 0 6px rgba(48, 181, 237, 0.25),
        0 0 0 12px rgba(48, 181, 237, 0.15),
        0 0 15px rgba(48, 181, 237, 0.35);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow:
            0 0 0 6px rgba(48, 181, 237, 0.25),
            0 0 0 12px rgba(48, 181, 237, 0.15),
            0 0 15px rgba(48, 181, 237, 0.35);
    }
    50% {
        box-shadow:
            0 0 0 8px rgba(48, 181, 237, 0.3),
            0 0 0 14px rgba(48, 181, 237, 0.2),
            0 0 20px rgba(48, 181, 237, 0.4);
    }
}

.step-dot.completed {
    background: var(--primary-orange);
    color: white;
    box-shadow: var(--shadow-md);
}

.step-connector {
    flex: 1;
    height: 2px;
    background: #E2E8F0;
    margin: 0 16px;
    z-index: 1;
}

.step-connector.active {
    background: var(--primary-orange);
}

.step-indicator-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 500px;
    position: relative;
    margin-bottom: 32px;
    padding: 0 24px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 20px);
    right: calc(-50% + 20px);
    height: 3px;
    background: #E2E8F0;
    z-index: 10;
}

.step-item.completed:not(:last-child)::after {
    background: var(--primary-orange);
}

.step-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

.step-label.active {
    color: var(--primary-orange);
    font-weight: 600;
}

/* Success Panel */
.success-panel {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.success-illustration {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: white;
    font-weight: bold;
    z-index: 2;
    position: relative;
}

.success-bg {
    position: absolute;
    width: 100%;
    height: 100%;
}

.success-circle {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: pulse 4s ease-in-out infinite;
}

.circle-1 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.circle-2 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 1s;
}

.circle-3 {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 2s;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.1); }
}

/* Content Panel */
.content-panel {
    background: var(--surface);
    border-radius: var(--radius-2xl);
    padding: 48px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
}

/* Summary Panel */
.summary-panel {
    background: var(--surface);
    display: flex;
    flex-direction: column;
    padding: 40px;
    border-right: 1px solid var(--border-light);
}

.summary-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.summary-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.patient-info {
    margin-bottom: 40px;
}

.patient-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.patient-dob {
    font-size: 16px;
    color: var(--text-secondary);
}

.refill-counter {
    text-align: center;
    padding: 32px;
    background: var(--surface-light);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.counter-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.counter-value {
    font-size: 72px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.counter-validity {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
}


.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.step-item.active .step-number {
    background: var(--primary-blue);
    color: white;
}

.step-item.completed .step-number {
    background: var(--primary-blue);
    color: white;
}

.step-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.step-item.active .step-label {
    color: var(--primary-blue);
    font-weight: 600;
}

/* Form Content */
.form-content {
    flex: 1;
}

.step-info {
    margin-bottom: 32px;
}

.step-counter {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}

.step-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.step-title + .form {
    margin-top: 32px;
}

.step-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.success-message {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 12px;
}

/* Form Styles */
.form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    font-size: 16px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
    font-weight: 400 !important;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

/* Success state should override focus state */
.input-group.success input:focus,
.input-group.success select:focus {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1) !important;
}

.input-group.success .date-input-container input:focus {
    border-color: var(--success) !important;
    box-shadow: none !important;
}

.input-group.success .date-input-container:focus-within {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1) !important;
}

.input-group input::placeholder {
    color: var(--text-light);
}

/* Date input with template overlay */
.date-input-container {
    position: relative;
    width: 100%;
}

.date-input-container input {
    background: transparent;
    color: transparent;
    z-index: 2;
    caret-color: var(--text-primary);
    width: 100%;
}

.input-group.success .date-input-container input {
    background: transparent !important;
}

.date-template {
    position: absolute;
    top: 18px;
    left: 20px;
    font-size: 16px;
    color: var(--text-light);
    pointer-events: none;
    z-index: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    line-height: 1.5;
}

/* Field validation styles */
.input-group.error input,
.input-group.error .date-input-container input {
    border-color: var(--error);
    background-color: var(--error-light);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.input-group.success input {
    border-color: var(--success);
    background-color: var(--success-light) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.input-group.success .date-input-container input {
    border-color: var(--success);
    background-color: var(--success-light) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.input-group.success .date-input-container {
    background-color: var(--success-light) !important;
    border-radius: var(--radius-xl);
    border: 1px solid var(--success);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    overflow: hidden;
}

/* Remove double shadow effect for date container */
.input-group.success .date-input-container input {
    box-shadow: none !important;
}

.field-message {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-message.error {
    color: var(--error);
}

.field-message.success {
    color: var(--success);
}

.field-message.checking {
    color: var(--primary-orange);
}

.field-message .icon {
    font-size: 16px;
}

/* Animated dots for loading states */
.dots-animation {
    display: inline-block;
}

.dots-animation::after {
    content: '.';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 25% {
        content: '.';
    }
    26%, 50% {
        content: '..';
    }
    51%, 75% {
        content: '...';
    }
    76%, 100% {
        content: '.';
    }
}

/* iOS Safari date input fixes */
.input-group input[type="date"] {
    text-align: left;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3e%3cpath fill-rule='evenodd' d='M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zM4 7h12v9H4V7z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 16px 16px;
    padding-right: 50px;
    min-height: 56px;
    height: 56px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
}

/* Hide Chrome's native calendar icon */
.input-group input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

/* Additional iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .input-group input[type="date"] {
        text-align: left !important;
        -webkit-text-fill-color: var(--text-primary);
        -webkit-opacity: 1;
        direction: ltr;
        -webkit-writing-mode: horizontal-tb;
        writing-mode: horizontal-tb;
    }

    .input-group input[type="date"] {
        text-align: left !important;
        -webkit-text-align: left !important;
        direction: ltr !important;
    }

    .input-group input[type="date"]::-webkit-datetime-edit {
        text-align: left !important;
        -webkit-text-align: left !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        direction: ltr !important;
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
        font-size: 16px !important;
        font-weight: 400 !important;
    }

    .input-group input[type="date"]::-webkit-datetime-edit-fields-wrapper {
        text-align: left !important;
        -webkit-text-align: left !important;
        direction: ltr !important;
        font-family: inherit !important;
    }

    .input-group input[type="date"]::-webkit-datetime-edit-text {
        text-align: left !important;
        -webkit-text-align: left !important;
        direction: ltr !important;
        font-family: inherit !important;
        color: var(--text-secondary);
    }

    .input-group input[type="date"]::-webkit-datetime-edit-month-field,
    .input-group input[type="date"]::-webkit-datetime-edit-day-field,
    .input-group input[type="date"]::-webkit-datetime-edit-year-field {
        text-align: left !important;
        -webkit-text-align: left !important;
        direction: ltr !important;
    }

    /* Show placeholder-like text when empty */
    .input-group input[type="date"]:invalid::-webkit-datetime-edit {
        color: var(--text-secondary) !important;
    }

    .input-group input[type="date"]:valid::-webkit-datetime-edit {
        color: var(--text-primary) !important;
    }

    /* Force font consistency on all iOS Safari elements */
    * {
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
    }
}

/* Chrome/Chromium specific font fixes */
@supports (-webkit-appearance: none) and (not (-webkit-touch-callout: none)) {
    input, textarea, select, button {
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
        font-size: inherit !important;
        font-weight: inherit !important;
    }
}

/* Firefox specific font fixes */
@-moz-document url-prefix() {
    * {
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
    }
}

/* Cross-browser font consistency for form elements */
input, textarea, select, button, optgroup, option {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* Additional Rx */
.additional-rx {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 0px;
}

.rx-field {
    position: relative;
}

.remove-rx-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--error);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.remove-rx-btn:hover {
    background: #DC2626;
    transform: translateY(-50%) scale(1.1);
}

/* Add Prescription Button */
.add-prescription-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-prescription-btn:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    background: rgba(30, 58, 138, 0.05);
}

.plus-icon {
    font-size: 20px;
    font-weight: bold;
}

/* Buttons */
.primary-btn {
    background: var(--primary-orange);
    color: white;
    border: none;
    padding: 18px 32px;
    border-radius: var(--radius-2xl);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    margin-top: 24px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn:hover {
    background: var(--primary-orange-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.primary-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-btn {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 18px 32px;
    border-radius: var(--radius-xl);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.secondary-btn:hover {
    background: var(--surface-light);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

.action-buttons .secondary-btn,
.action-buttons .primary-btn {
    flex: 1;
    margin: 0;
}

/* Selection Cards */
.selection-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    margin-bottom: 32px;
}

.selection-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

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

.selection-card.selected {
    border-color: var(--primary-orange);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 20px;
    color: white;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.card-price {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--primary-orange);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.selection-card.not-eligible {
    /* Remove disabled styling - all cards should look clickable */
    cursor: pointer;
}

.selection-card.not-eligible:hover {
    /* Use same hover effect as eligible cards */
    transform: translateY(-2px);
    border-color: var(--primary-orange); /* Use same darker blue as eligible cards */
    box-shadow: var(--shadow-lg);
}

/* Prevent hover styles from overriding selected state */
.selection-card.selected:hover {
    /* Keep selected styling consistent regardless of eligibility */
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
}

.selection-card.not-eligible .card-icon {
    /* Keep the warning icon styling but make it look active */
    background: #EF4444; /* Red background for warning */
}

.prescription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rx-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.status-badge.not-eligible {
    background: var(--error);
    color: white;
}

.prescription-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Confirmation Card */
.confirmation-card {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.confirmation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.confirmation-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.confirmation-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Force full coverage including status bar */
    top: calc(env(safe-area-inset-top, 0) * -1);
    left: calc(env(safe-area-inset-left, 0) * -1);
    width: calc(100vw + env(safe-area-inset-left, 0) + env(safe-area-inset-right, 0));
    height: calc(100vh + env(safe-area-inset-top, 0) + env(safe-area-inset-bottom, 0));
    /* iOS specific overrides */
    height: calc(100dvh + env(safe-area-inset-top, 0) + env(safe-area-inset-bottom, 0));
    min-height: calc(100dvh + env(safe-area-inset-top, 0) + env(safe-area-inset-bottom, 0));
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Negative margins to extend beyond any constraints */
    margin-top: calc(-1 * env(safe-area-inset-top, 0));
    margin-left: calc(-1 * env(safe-area-inset-left, 0));
    margin-right: calc(-1 * env(safe-area-inset-right, 0));
    margin-bottom: calc(-1 * env(safe-area-inset-bottom, 0));
}

.loading-content {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-2xl);
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    border-radius: var(--radius-lg);
    z-index: 1001;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-xl);
    min-width: 320px;
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: white;
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .split-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .illustration-panel,
    .summary-panel {
        min-height: 200px;
        padding: 20px;
    }
    
    .form-panel {
        padding: 24px 20px;
    }
    
    .medical-bg {
        width: 200px;
        height: 200px;
    }
    
    .step-indicator {
        margin-bottom: 24px;
    }
    
    .step-item {
        gap: 4px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .step-label {
        font-size: 10px;
    }
    
    .step-title {
        font-size: 24px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .prescription-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .prescription-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .counter-value {
        font-size: 48px;
    }
    
    .toast {
        left: 20px;
        right: 20px;
        transform: translateY(100px);
        min-width: auto;
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .form-panel {
        padding: 20px 16px;
    }

    .illustration-panel,
    .summary-panel {
        padding: 16px;
        min-height: 150px;
    }

    .step-title {
        font-size: 22px;
    }

    .primary-btn,
    .secondary-btn {
        padding: 14px 24px;
        font-size: 14px;
    }

    /* Fix prescription card centering on mobile */
    .selection-card {
        padding: 24px 16px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .card-icon {
        margin: 0 auto 12px !important;
        align-self: center !important;
        width: 48px !important;
        height: 48px !important;
        flex-shrink: 0 !important;
    }

    .card-title {
        margin-bottom: 6px !important;
        text-align: center !important;
        align-self: center !important;
    }

    .card-description {
        text-align: center !important;
        margin-bottom: 8px !important;
        align-self: center !important;
    }

    .card-price {
        position: static !important;
        margin: 8px auto 0 auto !important;
        align-self: center !important;
        width: auto !important;
        flex-shrink: 0 !important;
    }

    /* Fix the patient header and inline-styled elements */
    .selection-cards > div:first-child {
        text-align: center !important;
    }

    .selection-cards > div:first-child > div {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Cross-browser mobile centering for all small screens */
@media screen and (max-width: 480px) {
    /* Universal centering for prescription list */
    #prescriptionList {
        display: -webkit-box !important;
        display: -webkit-flex !important;
        display: -ms-flexbox !important;
        display: flex !important;
        -webkit-box-orient: vertical !important;
        -webkit-box-direction: normal !important;
        -webkit-flex-direction: column !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
        -webkit-box-align: center !important;
        -webkit-align-items: center !important;
        -ms-flex-align: center !important;
        align-items: center !important;
        text-align: center !important;
    }

    /* Patient header - Safari specific centering */
    #prescriptionList > div:first-child {
        text-align: center !important;
        width: 100% !important;
        display: -webkit-box !important;
        display: -webkit-flex !important;
        display: -ms-flexbox !important;
        display: flex !important;
        -webkit-box-orient: vertical !important;
        -webkit-box-direction: normal !important;
        -webkit-flex-direction: column !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
        -webkit-box-align: center !important;
        -webkit-align-items: center !important;
        -ms-flex-align: center !important;
        align-items: center !important;
        -webkit-box-pack: center !important;
        -webkit-justify-content: center !important;
        -ms-flex-pack: center !important;
        justify-content: center !important;
    }

    #prescriptionList > div:first-child div {
        text-align: center !important;
        margin: 0 auto !important;
        display: block !important;
        width: 100% !important;
    }

    /* Prescription card - Universal flexbox centering */
    .selection-card {
        padding: 24px 16px !important;
        display: -webkit-box !important;
        display: -webkit-flex !important;
        display: -ms-flexbox !important;
        display: flex !important;
        -webkit-box-orient: vertical !important;
        -webkit-box-direction: normal !important;
        -webkit-flex-direction: column !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
        -webkit-box-align: center !important;
        -webkit-align-items: center !important;
        -ms-flex-align: center !important;
        align-items: center !important;
        -webkit-box-pack: center !important;
        -webkit-justify-content: center !important;
        -ms-flex-pack: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Force center all card content */
    .selection-card .card-title,
    .selection-card .card-description {
        text-align: center !important;
        -webkit-align-self: center !important;
        -ms-flex-item-align: center !important;
        align-self: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
        width: 100% !important;
    }

    .selection-card .card-icon {
        margin: 0 auto 12px auto !important;
        -webkit-align-self: center !important;
        -ms-flex-item-align: center !important;
        align-self: center !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
        flex-shrink: 0 !important;
        -webkit-flex-shrink: 0 !important;
        -ms-flex-negative: 0 !important;
        display: flex !important;
        display: -webkit-box !important;
        display: -webkit-flex !important;
        display: -ms-flexbox !important;
        border-radius: 50% !important;
        text-align: center !important;
    }
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
    @media screen and (max-width: 480px) {
        .selection-card {
            -webkit-transform: translateZ(0) !important;
            transform: translateZ(0) !important;
        }

        .selection-card .card-title,
        .selection-card .card-description {
            -webkit-text-align-last: center !important;
            text-align-last: center !important;
        }
    }
}

/* Refill Options Styles */
.delivery-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

.option-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.option-card.selected {
    border-color: var(--primary-orange);
    background: rgba(30, 58, 138, 0.05);
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.15);
}

.option-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.option-content h3 {
    margin: 0 0 8px 0;
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 600;
}

.option-content p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .delivery-options {
        grid-template-columns: 1fr;
    }
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Large desktop screens */
@media (min-width: 1200px) {
    .form-panel,
    .summary-panel {
        padding: 60px;
    }
    
    .step-title {
        font-size: 36px;
    }
    
    .prescription-details {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Remove autofill background color */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background-color: var(--surface) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* For date inputs specifically */
input[type="tel"]:-webkit-autofill,
input[type="text"]:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background-color: var(--surface) !important;
}

/* Accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Refill confirmation styling */
.refill-confirmation {
    text-align: center;
}

.refill-confirmation .primary-btn {
    margin: 0 auto;
    display: block;
}

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

