/* Kiosk-Grade UI Styles for Pharmacy Registration */

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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Arial Unicode MS';
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS fix */
    overflow: auto; /* Allow scrolling on mobile */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    direction: rtl; /* Right-to-left for Arabic */
    text-align: right;
}

/* Mobile viewport fix */
@supports (-webkit-touch-callout: none) {
    html {
        height: -webkit-fill-available;
    }
}

/* Kiosk Container - Full Screen */
.kiosk-container {
    width: 100vw;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Mobile specific adjustments - ONLY for phones (not tablets!) */
@media (max-width: 600px) {
    .kiosk-container {
        padding: 10px;
        align-items: flex-start;
    }
}

/* Landing Container - No Background */
.landing-container {
    width: 100vw;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

@media (max-width: 600px) {
    .landing-container {
        padding: 10px;
        align-items: flex-start;
    }
}

/* Landing Page - No Background */
.landing-page {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Registration Form */
.registration-form {
    width: 95%;
    max-width: 1200px;
    height: 95%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    padding: 40px;
    position: relative;
}

/* Header Section */
.header {
    margin-bottom: 40px;
    direction: ltr;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logo-section {
    flex: 0 0 auto;
    text-align: left;
}

.text-section {
    flex: 1;
    text-align: right;
    padding-right: 20px;
}

/* Arabic Text Support */
.title, .subtitle, .input-label, .confirmation-title, .confirmation-subtitle, .instruction {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Arial Unicode MS';
    direction: rtl;
    text-align: center;
}

.input-label {
    text-align: right;
    direction: rtl;
}

.error-message {
    direction: rtl;
    text-align: right;
}

.pharmacy-logo {
    max-height: 120px;
    max-width: 300px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    display: block;
}

.title {
    font-size: 48px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 24px;
    color: #4a5568;
    font-weight: 400;
}

/* Form Content Layout */
.form-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 60px;
    flex: 1;
    align-items: start;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding-top: 20px;
}

.input-group {
    position: relative;
    transition: all 0.3s ease;
}

.input-group.active {
    transform: scale(1.02);
}

.input-label {
    display: block;
    font-size: 22px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
    background: #f7fafc;
    border: 4px solid #e2e8f0;
    border-radius: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.input-group.active .input-wrapper {
    border-color: #3182ce;
    background: #ebf8ff;
    box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.1);
}

/* Prescription Row - Input + ABC Button Side by Side */
.prescription-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.prescription-input-wrapper {
    flex: 1;
    max-width: 70%;
}

/* Consistent width for all input fields (same as prescription) */
.input-wrapper-consistent {
    max-width: 70%;
}

/* ABC Toggle Button Inline */
.abc-toggle-btn-inline {
    padding: 20px 35px;
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    border: 3px solid #7c3aed;
    border-radius: 12px;
    color: white;
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    min-width: 120px;
    animation: fadeIn 0.3s ease-in-out;
}

.abc-toggle-btn-inline:hover {
    background: linear-gradient(145deg, #7c3aed, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

.abc-toggle-btn-inline:active {
    background: linear-gradient(145deg, #6d28d9, #5b21b6);
    transform: translateY(0px);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.abc-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 3px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.kiosk-input {
    width: 100%;
    padding: 24px 28px;
    font-size: 28px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #2d3748;
    outline: none;
    letter-spacing: 2px;
    caret-color: transparent; /* Hide text cursor since we use custom cursor */
}

.kiosk-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

/* Custom Input Cursor */
.input-cursor {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 32px;
    background: #3182ce;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.input-cursor.blinking {
    opacity: 1;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Error Messages */
.error-message {
    color: #e53e3e;
    font-size: 18px;
    font-weight: 600;
    margin-top: 12px;
    padding: 8px 16px;
    background: #fed7d7;
    border-radius: 8px;
    border-left: 4px solid #e53e3e;
}

/* Numpad Section */
.numpad-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Processing Overlay */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #e2e8f0;
    border-top: 6px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

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

.processing-overlay p {
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
}

/* Confirmation Screen */
.confirmation-screen {
    width: 95%;
    max-width: 800px;
    height: 95%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirmation-content {
    text-align: center;
    padding: 60px;
}

.success-icon {
    font-size: 120px;
    color: #38a169;
    margin-bottom: 40px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.confirmation-title {
    font-size: 56px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 24px;
}

.confirmation-subtitle {
    font-size: 32px;
    color: #4a5568;
    margin-bottom: 40px;
    font-weight: 500;
}

.serial-number {
    font-size: 120px;
    font-weight: 900;
    color: #3182ce;
    margin: 40px 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: 8px;
    padding: 40px;
    background: linear-gradient(145deg, #ebf8ff, #bee3f8);
    border-radius: 20px;
    border: 4px solid #3182ce;
    transition: all 0.3s ease;
}

.serial-number.flashing {
    animation: flash 0.5s ease-in-out infinite alternate;
}

@keyframes flash {
    0% {
        background: linear-gradient(145deg, #ebf8ff, #bee3f8);
        color: #3182ce;
        transform: scale(1);
    }
    100% {
        background: linear-gradient(145deg, #3182ce, #2c5aa0);
        color: white;
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(49, 130, 206, 0.5);
    }
}

.instruction {
    font-size: 28px;
    color: #4a5568;
    font-weight: 500;
    margin-top: 40px;
}

/* Landing Page Styles */
.landing-page {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.service-selection {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.landing-service-btn {
    background: linear-gradient(135deg, #87CEEB, #ADD8E6);
    color: #2C3E50;
    border: none;
    border-radius: 15px;
    padding: 25px 50px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(135, 206, 235, 0.3);
    min-width: 350px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
}

.landing-service-btn:hover {
    background: linear-gradient(135deg, #ADD8E6, #87CEEB);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(135, 206, 235, 0.4);
}

.landing-service-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(135, 206, 235, 0.3);
}

/* Back Button Styles */
.back-button-section {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    align-items: flex-end;
}

.back-btn, .return-landing-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Segoe UI', 'Tahoma', 'Arial Unicode MS', 'Noto Sans Arabic', sans-serif;
    white-space: nowrap;
    width: 100%;
    direction: rtl;
}

.back-btn:hover, .return-landing-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.back-btn:active, .return-landing-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-icon, .return-icon {
    font-size: 20px;
    font-weight: bold;
}

.back-text, .return-text {
    font-size: 16px;
}

/* QR Scanner Button - Same style as return button */
.qr-scan-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Segoe UI', 'Tahoma', 'Arial Unicode MS', 'Noto Sans Arabic', sans-serif;
    white-space: nowrap;
    width: 100%;
    direction: rtl;
}

.qr-scan-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.qr-scan-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.qr-text {
    font-size: 16px;
}

/* QR Scanner Modal */
.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.qr-modal-content {
    background: white;
    border-radius: 20px;
    padding: 20px;
    max-width: 480px;
    width: 70%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.qr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.qr-modal-header h3 {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.qr-close-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qr-close-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.qr-instructions {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 15px;
    font-weight: 500;
}

#qr-reader {
    border: 2px solid #10b981;
    border-radius: 12px;
    overflow: hidden;
}

.qr-controls {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.qr-switch-btn {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.qr-switch-btn:hover {
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4);
}

.qr-switch-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Service Type Display */
.service-type-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.service-type-text {
    font-size: 18px;
    font-weight: bold;
    color: #2d3748;
    margin: 0;
    text-align: center;
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.service-buttons {
    display: flex;
    gap: 80px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.service-btn {
    width: 320px;
    height: 240px;
    border: none;
    border-radius: 24px;
    background: white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.service-btn:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

.service-btn:active {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.insurance-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.prescription-btn {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
}

.btn-icon {
    font-size: 48px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.btn-text {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Design - DISABLED for tablets */
/* Tablets now ALWAYS use horizontal layout (601px+) */
/* This rule was causing vertical stacking on tablets */

@media (max-width: 600px) {
    .registration-form {
        padding: 20px;
    }
    
    .title {
        font-size: 36px;
    }
    
    .subtitle {
        font-size: 18px;
    }
    
    .kiosk-input {
        font-size: 24px;
        padding: 20px 24px;
    }
    
    .input-label {
        font-size: 18px;
    }
    
    .serial-number {
        font-size: 80px;
        letter-spacing: 4px;
    }
    
    .service-buttons {
        flex-direction: column;
        gap: 40px;
    }
    
    .service-btn {
        width: 280px;
        height: 200px;
    }
    
    .btn-text {
        font-size: 20px;
    }
    
    .btn-icon {
        font-size: 40px;
    }
    
    .landing-service-btn {
        font-size: 20px;
        padding: 20px 40px;
        min-width: 280px;
    }
    
    .service-selection {
        gap: 30px;
        padding: 20px;
    }
    
    .back-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .back-icon {
        font-size: 18px;
    }
    
    .back-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 28px;
    }
    
    .kiosk-input {
        font-size: 20px;
        padding: 16px 20px;
    }
    
    .serial-number {
        font-size: 60px;
        letter-spacing: 2px;
    }
    
    .landing-service-btn {
        font-size: 18px;
        padding: 18px 35px;
        min-width: 250px;
    }
    
    .service-selection {
        gap: 25px;
        padding: 15px;
    }
}

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

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .kiosk-container {
        background: #000;
    }
    
    .registration-form {
        background: #fff;
        border: 4px solid #000;
    }
    
    .input-wrapper {
        border-color: #000;
    }
    
    .input-group.active .input-wrapper {
        border-color: #0066cc;
        background: #f0f8ff;
    }
}

/* Touch-specific optimizations */
@media (pointer: coarse) {
    .input-wrapper {
        min-height: 80px;
    }
    
    .kiosk-input {
        padding: 28px 32px;
    }
}

/* Prevent text selection and context menus */
.kiosk-container * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Focus styles for accessibility */
.input-wrapper:focus-within {
    outline: 4px solid #3182ce;
    outline-offset: 2px;
}

/* Print styles (hide everything for kiosk) */
@media print {
    .kiosk-container {
        display: none;
    }
}

/* API Error Message - Modern, Well-Styled Alert */
.api-error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 4px solid #fc8181;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(252, 129, 129, 0.1);
    padding: 40px 60px;
    z-index: 2000;
    max-width: 600px;
    width: 90%;
    text-align: center;
    direction: rtl;
    animation: errorSlideIn 0.4s ease-out;
}

@keyframes errorSlideIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.api-error-message .error-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: errorPulse 1.5s ease-in-out infinite;
}

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

.api-error-message .error-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial Unicode MS', 'Noto Sans Arabic', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #742a2a;
    line-height: 1.6;
    margin-bottom: 32px;
    direction: rtl;
    text-align: center;
    word-wrap: break-word;
}

.api-error-message .dismiss-error-btn {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 48px;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(252, 129, 129, 0.4);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial Unicode MS', sans-serif;
}

.api-error-message .dismiss-error-btn:hover {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(252, 129, 129, 0.5);
}

.api-error-message .dismiss-error-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(252, 129, 129, 0.4);
}

/* Overlay for error message */
.api-error-message::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* ========================================
   TABLET SPECIFIC STYLES (769px - 1024px)
   ======================================== */

/* Tablets: Keep side-by-side layout but adjust sizes */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .registration-form {
        max-width: 95%;
        padding: 30px 20px;
    }
    
    .form-content {
        grid-template-columns: 1fr 350px;
        gap: 30px;
    }
    
    .input-section {
        gap: 30px;
    }
    
    .input-label {
        font-size: 20px;
    }
    
    .kiosk-input {
        font-size: 22px;
        padding: 16px 20px;
    }
    
    .numpad-section {
        padding: 15px;
    }
    
    .title {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 18px;
    }
    
    .landing-service-btn {
        font-size: 28px;
        padding: 30px;
        min-height: 100px;
    }
    
    .main-master-container {
        max-width: 500px;
    }
}

/* ========================================
   MOBILE & ANDROID RESPONSIVE FIXES
   ======================================== */

/* Fix Android viewport height issues - ONLY for phones */
@media screen and (max-width: 600px) {
    html {
        height: 100%;
        height: -webkit-fill-available;
    }
    
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Fix registration form on mobile */
    .registration-form {
        max-width: 100%;
        width: 100%;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding: 10px;
    }
    
    /* Fix header on mobile */
    .header {
        padding: 15px 10px;
        min-height: auto;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo-section img {
        max-width: 120px;
        height: auto;
    }
    
    .title {
        font-size: 24px !important;
    }
    
    .subtitle {
        font-size: 16px !important;
    }
    
    /* Fix form content on mobile */
    .form-content {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
        overflow-y: auto;
    }
    
    /* Fix input section */
    .input-section {
        width: 100%;
        min-height: auto;
        padding: 15px 10px;
    }
    
    .input-group {
        margin-bottom: 15px;
    }
    
    .input-label {
        font-size: 18px !important;
    }
    
    .kiosk-input {
        font-size: 20px !important;
        padding: 12px !important;
        min-height: 50px;
    }
    
    /* Fix numpad on mobile */
    .numpad-section {
        width: 100%;
        max-width: 100%;
        padding: 10px;
    }
    
    .numpad-grid {
        gap: 8px;
    }
    
    .numpad-btn {
        font-size: 22px !important;
        padding: 15px !important;
        min-height: 60px;
    }
    
    /* Fix MainMaster page on mobile */
    .main-master-container {
        margin: 20px auto;
        padding: 30px 20px;
        max-width: 100%;
        width: 90%;
    }
    
    .main-title {
        font-size: 1.5rem !important;
    }
    
    .main-subtitle {
        font-size: 0.95rem !important;
    }
    
    .store-dropdown {
        font-size: 1rem !important;
        padding: 14px 18px !important;
    }
    
    /* Fix landing page on mobile */
    .landing-page {
        height: auto;
        min-height: 100vh;
        padding: 20px 10px;
    }
    
    .main-content {
        padding: 20px 10px;
    }
    
    .service-selection {
        gap: 15px;
    }
    
    .landing-service-btn {
        font-size: 20px !important;
        padding: 18px !important;
        min-height: 70px;
    }
    
    /* Fix confirmation screen on mobile */
    .confirmation-screen {
        padding: 20px 10px;
    }
    
    .serial-number {
        font-size: 80px !important;
        padding: 30px !important;
    }
    
    /* Fix buttons on mobile */
    .main-btn,
    .return-landing-btn {
        font-size: 18px !important;
        padding: 14px !important;
        min-height: 55px;
    }
    
    /* Ensure scrolling works on mobile */
    .kiosk-main {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Very small screens (phones in portrait) */
@media screen and (max-width: 480px) {
    .title {
        font-size: 20px !important;
    }
    
    .subtitle {
        font-size: 14px !important;
    }
    
    .kiosk-input {
        font-size: 18px !important;
    }
    
    .numpad-btn {
        font-size: 20px !important;
        min-height: 55px;
    }
    
    .serial-number {
        font-size: 60px !important;
    }
}

/* Fix for Android Chrome address bar issue */
@supports (-webkit-touch-callout: none) {
    .kiosk-container,
    .landing-container {
        min-height: -webkit-fill-available;
    }
}

/* Prevent text selection on mobile (kiosk mode) */
@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    input,
    textarea {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* Fix safe area for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* ========================================
   LANDSCAPE ORIENTATION OPTIMIZATION
   ======================================== */

/* Force proper scaling for all screens */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Tablets and larger - FORCE horizontal layout for tablets == */
@media screen and (min-width: 601px) {
    /* Remove mobile overrides */
    .kiosk-container,
    .landing-container {
        padding: 20px !important;
        align-items: center !important;
    }
    
    .registration-form {
        width: 95% !important;
        max-width: 1400px !important;
        height: auto !important;
        min-height: 85vh !important;
        padding: 40px 50px !important;
    }
    
    .form-content {
        display: grid !important;
        grid-template-columns: 1fr 400px !important;
        gap: 40px !important;
        flex-direction: row !important;
    }
    
    .input-section {
        gap: 35px;
    }
    
    .kiosk-input {
        font-size: 24px;
        padding: 18px 25px;
        height: auto;
    }
    
    .input-label {
        font-size: 22px;
    }
    
    .numpad-section {
        padding: 20px;
        max-width: 400px;
    }
    
    .numpad-button {
        font-size: 28px;
        padding: 18px;
        min-height: 65px;
    }
    
    .landing-service-btn {
        font-size: 30px;
        padding: 35px 40px;
        min-height: 110px;
        max-width: 600px;
    }
    
    .title {
        font-size: 32px;
        margin-bottom: 15px;
    }
    
    .subtitle {
        font-size: 20px;
    }
    
    .main-master-container {
        max-width: 600px;
    }
}

/* Large tablets and desktops (1024px+) */
@media screen and (min-width: 1024px) {
    .registration-form {
        max-width: 1600px;
        padding: 50px 60px;
    }
    
    .form-content {
        grid-template-columns: 1fr 450px !important;
        gap: 50px;
    }
    
    .kiosk-input {
        font-size: 26px;
    }
    
    .numpad-button {
        font-size: 32px;
        min-height: 75px;
    }
    
    .landing-service-btn {
        font-size: 34px;
        min-height: 130px;
        max-width: 700px;
    }
}

/* ========================================
   CRITICAL FIX: FORCE HORIZONTAL FOR ALL TABLETS
   Honor X8a 11" and similar devices
   ======================================== */

/* Override ALL previous rules - FORCE horizontal layout */
@media screen and (min-width: 601px) and (max-width: 2000px) {
    .form-content {
        display: grid !important;
        grid-template-columns: 1fr 350px !important;
        grid-template-rows: auto !important;
        flex-direction: row !important;
        gap: 25px !important;
        overflow: visible !important;
    }
    
    .input-section {
        order: 0 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .numpad-section {
        order: 1 !important;
        width: 350px !important;
        max-width: 350px !important;
        display: block !important;
        padding: 15px !important;
    }
    
    /* Make inputs smaller to fit */
    .kiosk-input {
        font-size: 20px !important;
        padding: 12px 18px !important;
        min-height: 50px !important;
    }
    
    .input-label {
        font-size: 18px !important;
        margin-bottom: 6px !important;
    }
    
    /* Make numpad buttons smaller */
    .numpad-button {
        font-size: 24px !important;
        padding: 12px !important;
        min-height: 55px !important;
    }
    
    .numpad-grid {
        gap: 8px !important;
    }
    
    /* Reduce header size */
    .title {
        font-size: 26px !important;
        margin-bottom: 8px !important;
    }
    
    .subtitle {
        font-size: 16px !important;
    }
    
    /* Make registration form more compact */
    .registration-form {
        padding: 25px 35px !important;
    }
}

/* Specific fix for 11" tablets in landscape (1920x1200 or similar) */
@media screen and (min-width: 1000px) and (orientation: landscape) {
    .form-content {
        display: grid !important;
        grid-template-columns: 1fr 380px !important;
        gap: 30px !important;
    }
    
    .numpad-section {
        width: 380px !important;
        max-width: 380px !important;
        padding: 18px !important;
    }
    
    /* Slightly bigger for 11" tablets but still compact */
    .kiosk-input {
        font-size: 22px !important;
        padding: 14px 20px !important;
        min-height: 55px !important;
    }
    
    .input-label {
        font-size: 20px !important;
    }
    
    .numpad-button {
        font-size: 26px !important;
        padding: 14px !important;
        min-height: 58px !important;
    }
    
    .title {
        font-size: 28px !important;
    }
    
    .subtitle {
        font-size: 18px !important;
    }
    
    /* Make sure everything fits in viewport */
    .registration-form {
        padding: 30px 40px !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
    }
    
    .header {
        margin-bottom: 20px !important;
    }
}