/* Global Styles for QRPay */
html, body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: linear-gradient(135deg, #2d5a27 0%, #4a7c59 100%);
    min-height: 100vh;
    /* Improve mobile performance */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal scrolling */
    overflow-x: hidden;
    /* Better text rendering on mobile */
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* Prevent zoom on input focus for iOS */
input, select, textarea {
    font-size: 16px;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #4a7c59;
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: #2d5a27;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #2d5a27, #4a7c59);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(74, 124, 89, 0.4);
}

.content {
    padding: 0;
}

.valid.modified:not([type=checkbox]) {
    outline: 2px solid #10b981;
    border-color: #10b981;
}

.invalid {
    outline: 2px solid #ef4444;
    border-color: #ef4444;
}

.validation-message {
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 4px;
}

#blazor-error-ui {
    color-scheme: light only;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    bottom: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 1rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-weight: 500;
    border-radius: 12px 12px 0 0;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA9NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA6OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3WiIgZmlsbD0iI0ZGRTUwMCIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9nPjwvc3ZnPg==) no-repeat 1rem/1.8rem, linear-gradient(135deg, #dc2626, #ef4444);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 12px;
    margin: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Modern Loading Screen Styles */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2d5a27 0%, #4a7c59 100%);
    z-index: 9999;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

/* Logo Styles */
.loading-logo {
    margin-bottom: 1.5rem;
    animation: logoFloat 3s ease-in-out infinite;
}

.loading-logo img {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2));
}

/* Title Styles */
.loading-title {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2rem 0;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

/* Progress Indicator */
.loading-progress-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.loading-progress {
    width: 80px;
    height: 80px;
    display: block;
}

.loading-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 4;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-fill {
    fill: none;
    stroke: #ffffff;
    stroke-width: 4;
    stroke-linecap: round;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.3s ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

/* Loading Text */
.loading-progress-text {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    opacity: 0.9;
    animation: pulse 2s ease-in-out infinite;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading QRPay");
}

/* Subtitle */
.loading-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    opacity: 0.8;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.05);
    }
}

@keyframes titleGlow {
    0% {
        text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 255, 255, 0.1);
    }
    100% {
        text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

code {
    color: #4a7c59;
    background: rgba(74, 124, 89, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Form Controls Override */
.form-floating > .form-control-plaintext::placeholder, 
.form-floating > .form-control::placeholder {
    color: #9ca3af;
    text-align: start;
}

.form-floating > .form-control-plaintext:focus::placeholder, 
.form-floating > .form-control:focus::placeholder {
    text-align: start;
    opacity: 0.7;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Improve tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(74, 124, 89, 0.2);
    }
    
    /* Better button touch targets */
    button, .btn, input[type="button"], input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve form control touch targets */
    input, textarea, select {
        min-height: 44px;
    }
    
    /* Disable iOS zoom on inputs */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* Mobile loading adjustments */
    .loading-logo img {
        width: 100px;
        height: 100px;
    }
    
    .loading-title {
        font-size: 2.5rem;
    }
    
    .loading-progress {
        width: 70px;
        height: 70px;
    }
    
    .loading-progress-text {
        font-size: 0.9rem;
    }
    
    .loading-subtitle {
        font-size: 0.9rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .loading-content {
        padding: 1.5rem;
    }
    
    .loading-logo img {
        width: 80px;
        height: 80px;
    }
    
    .loading-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .loading-progress {
        width: 60px;
        height: 60px;
    }
    
    .loading-progress-text {
        font-size: 0.85rem;
    }
    
    .loading-subtitle {
        font-size: 0.85rem;
    }
    
    #blazor-error-ui {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Landscape mobile adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .loading-content {
        padding: 1rem;
    }
    
    .loading-logo {
        margin-bottom: 1rem;
    }
    
    .loading-logo img {
        width: 60px;
        height: 60px;
    }
    
    .loading-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .loading-progress {
        width: 50px;
        height: 50px;
    }
    
    .loading-progress-wrapper {
        margin-bottom: 1rem;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper rendering for high DPI */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-fill {
        transition: none !important;
    }
    
    .loading-logo,
    .loading-title,
    .loading-progress-text,
    .loading-content {
        animation: none !important;
    }
}