/* PWA-specific styles */

/* Ensure app takes full viewport */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    user-select: none;
}

/* Prevent zooming on input focus (iOS) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea,
select {
    font-size: 16px; /* Prevents auto-zoom on iOS */
}

/* Safe area for notch/rounded corners */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Status bar styling for PWA */
@media (display-mode: standalone) {
    body {
        background: #ffffff;
        color: #333;
    }
}

/* Prevent text selection on buttons/icons */
button,
[role="button"],
.icon {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Improve touch targets for mobile */
button,
a,
input[type="button"],
input[type="submit"],
[role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Status bar height compensation */
@media (max-height: 600px) {
    body {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}

/* Splash screen background during loading */
.app-loading {
    background: linear-gradient(135deg, #0d6efd 0%, #0d6efd 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: white;
}

.app-loading::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Install prompt styling */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideUp 0.3s ease-in-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .install-prompt {
        background: #1e1e1e;
        border-top-color: #333;
        color: #ffffff;
    }
}

/* Notification badge */
.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    background-color: #dc3545;
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
}

/* Landscape mode adjustments */
@media (orientation: landscape) {
    /* Use viewport custom properties for accurate height in landscape */
    .app-loading {
        height: calc(var(--vh, 1vh) * 100);
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    body {
        font-size: 14px;
    }

    button,
    a,
    [role="button"] {
        min-height: 40px;
        padding: 8px 12px;
    }
}

/* Landscape safe areas for notched devices (requires viewport-fit=cover) */
@media (orientation: landscape) {
    @supports (padding: max(0px)) {
        body {
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }
    }
}

/* Standalone PWA landscape layout */
@media (display-mode: standalone) and (orientation: landscape) {
    body {
        overflow-x: hidden;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
