/* Mobile-first PWA optimizations */

/* Prevent zoom on input focus in iOS */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Touch-friendly buttons */
button {
    min-height: 44px; /* Apple's recommended touch target size */
    min-width: 44px;
    touch-action: manipulation;
}

/* Improve scrolling on mobile */
body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* PWA specific styles */
@media (display-mode: standalone) {
    /* Add padding for status bar when in standalone mode */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (max-width: 768px) {
    /* Hide table headers on mobile */
    table thead {
        display: none;
    }

    /* Show all summary cards on mobile */
    #summary-in, #summary-out {
        display: block;
    }
    
    .container {
        margin: 10px;
        padding: 15px;
        width: auto;
        max-width: none;
    }
    
    /* Stack buttons vertically on small screens */
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Make table responsive */
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    /* Make overlay forms full screen on mobile */
    .overlay-content {
        width: 95%;
        max-width: none;
        margin: 10px;
    }
}

/* Landscape orientation optimizations */
@media (orientation: landscape) and (max-height: 500px) {
    .container {
        height: auto;
        min-height: auto;
    }
}

/* Force light theme for better visibility */
body, html {
    background-color: #f4f4f9 !important;
    color: #333 !important;
}

.container {
    background-color: #ffffff !important;
    color: #333 !important;
}

input, select, textarea, button {
    background-color: #ffffff !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
}

button {
    background-color: #2e7d32 !important;
    color: #ffffff !important;
}

table, th, td {
    background-color: #ffffff !important;
    color: #333 !important;
}



/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2e7d32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #ff6b6b;
    color: white;
    text-align: center;
    padding: 10px;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}
