/* Custom styles for Magic Van application */

/* Ensure minimum touch target sizes for mobile */
button, .btn, input[type="submit"], input[type="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Custom input styles */
input[type="tel"], input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* PIN input styling */
input[type="tel"][inputmode="numeric"] {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2em;
}

/* Scanner video styling */
#scanPreview {
    max-height: 400px;
    object-fit: cover;
}

/* Search results dropdown */
#searchResults {
    max-height: 200px;
    z-index: 1000;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
}

.search-result-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

/* Mobile-specific compact styling for search results */
@media (max-width: 768px) {
    .search-result-item {
        padding: 0.4rem 0.6rem;
    }
}

.search-result-item:hover {
    background-color: #f3f4f6;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-highlight {
    background-color: #fef3c7;
    font-weight: 600;
}

/* Table responsive enhancements */
@media (max-width: 768px) {
    .table-mobile-stack tr {
        display: block;
        border: 1px solid #e5e7eb;
        margin-bottom: 0.5rem;
        border-radius: 0.5rem;
        padding: 0.5rem;
    }
    
    .table-mobile-stack td {
        display: block;
        text-align: right;
        border: none;
        padding: 0.25rem 0;
    }
    
    .table-mobile-stack td:before {
        content: attr(data-label) ": ";
        float: left;
        font-weight: 600;
        color: #374151;
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #192A46;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

/* Action bar fixed positioning */
#actionBar {
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* Focus styles for accessibility */
input:focus, select:focus, textarea:focus, button:focus {
    outline: 2px solid #A6C56A;
    outline-offset: 2px;
}

/* Navigation icon colors */
header nav a i.fas {
    color: #A6C56A !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-magicnavy {
        background-color: #000000 !important;
    }
    
    .bg-magicgreen {
        background-color: #228B22 !important;
    }
    
    .text-magicnavy {
        color: #000000 !important;
    }
    
    .text-magicgreen {
        color: #228B22 !important;
    }
}

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

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}

/* Custom utility classes */
.text-shadow {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.backdrop-blur {
    backdrop-filter: blur(8px);
}

/* Toast notification styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.toast.show {
    transform: translateX(0);
}

/* Skeleton loading animation */
.skeleton {
    animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
    0% {
        background-color: hsl(200, 20%, 80%);
    }
    100% {
        background-color: hsl(200, 20%, 95%);
    }
}

/* Custom form validation styles */
.invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.valid {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
}

/* Hover and touch feedback */
.touch-feedback {
    transition: all 0.15s ease-in-out;
}

.touch-feedback:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.touch-feedback:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}
