* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #A020F0 0%, #8B1EDB 50%, #7A1CC9 100%);
    background-attachment: fixed;
    font-family: 'Noto Sans Lao Looped', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Apply Lao font to all text elements */
*, *::before, *::after {
    font-family: 'Noto Sans Lao Looped', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Specific font settings for better Lao text rendering */
html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, button, input, textarea, select, label, li, td, th {
    font-family: 'Noto Sans Lao Looped', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'liga' 1, 'kern' 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure Lao script is properly rendered - Google Fonts will handle @font-face */

/* Optimize font loading for Lao characters */
[lang="lo"], [lang="lo"] * {
    font-family: 'Noto Sans Lao Looped', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    font-feature-settings: 'liga' 1, 'kern' 1, 'calt' 1;
}

/* Ensure proper font weight for Lao text */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

p, span, div, label, button, a {
    font-weight: 400;
}

/* Bold text */
strong, b, .font-bold {
    font-weight: 700;
}

/* Semi-bold text */
.font-semibold {
    font-weight: 600;
}

/* Medium text */
.font-medium {
    font-weight: 500;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

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

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.card {
    transition: all 0.3s ease;
    transform: scale(1);
}

.card:active {
    transform: scale(0.98);
}

.btn-green {
    background-color: #22c55e;
    color: white;
    transition: all 0.2s ease;
}

.btn-green:active {
    background-color: #16a34a;
    transform: scale(0.98);
}

.input-field {
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active { background-color: #22c55e; color: white; }
.status-completed { background-color: #3b82f6; color: white; }
.status-overdue { background-color: #ef4444; color: white; }
.status-in_stock { background-color: #22c55e; color: white; }
.status-sold { background-color: #6b7280; color: white; }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    z-index: 1000;
}

.nav-item {
    transition: all 0.2s ease;
}

.nav-item.active {
    color: #22c55e;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    animation: toastSlide 0.3s ease-out;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #A020F0 0%, #8B1EDB 50%, #7A1CC9 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeOut 0.5s ease-out 2s forwards;
}

.splash-logo {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: scaleIn 0.8s ease-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.splash-title {
    font-size: 32px;
    font-weight: bold;
    color: white;
    margin-bottom: 8px;
    animation: slideUp 0.8s ease-out 0.3s both;
}

.splash-subtitle {
    font-size: 16px;
    color: rgba(255,255,255,0.9);
    animation: slideUp 0.8s ease-out 0.5s both;
}

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

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

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #A020F0 0%, #8B1EDB 50%, #7A1CC9 100%);
    background-attachment: fixed;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9997;
}

.page.login-container.active {
    display: flex;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideInUp 0.5s ease-out;
}

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

.pin-input-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 8px;
}

.pin-input {
    width: 64px;
    height: 64px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    background: #f9fafb;
    transition: all 0.2s ease;
    caret-color: #22c55e;
}

.pin-input:focus {
    outline: none;
    border-color: #22c55e;
    background: white;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
    transform: scale(1.05);
}

.pin-input.filled {
    border-color: #22c55e;
    background-color: #f0fdf4;
    color: #16a34a;
}

.pin-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.border-red-500 {
    border-color: #ef4444 !important;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.phone-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.phone-prefix-input {
    width: 80px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    color: #22c55e;
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    cursor: not-allowed;
    transition: all 0.2s ease;
}

.phone-prefix-input:focus {
    outline: none;
    border-color: #22c55e;
    background: white;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.phone-input-wrapper {
    flex: 1;
    position: relative;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
}

.phone-input-wrapper:focus-within {
    border-color: #22c55e;
    background: white;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.phone-input {
    width: 100%;
    padding: 16px;
    border: none;
    background: transparent;
}

.phone-input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.phone-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 28rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease-out;
}

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

.modal-title {
    font-size: 20px;
    font-weight: bold;
    color: #111827;
}

.modal-close {
    color: #6b7280;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #111827;
}

