/**
 * CheckEMS Portal - Custom Styles
 * Mobile-first approach with Tailwind CSS enhancements
 */

/* Base Styles */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* Focus Styles for Accessibility */
:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}

/* Form Input Enhancements */
input[type="text"]::-webkit-input-placeholder {
    color: #9ca3af;
    opacity: 1;
}

input[type="text"]::-moz-placeholder {
    color: #9ca3af;
    opacity: 1;
}

input[type="text"]:-ms-input-placeholder {
    color: #9ca3af;
}

input[type="text"]::-ms-input-placeholder {
    color: #9ca3af;
}

input[type="text"]::placeholder {
    color: #9ca3af;
}

/* Carrier Selection Animation */
.carrier-option .carrier-card {
    transition: all 0.2s ease;
}

.carrier-option:hover .carrier-card {
    transform: translateY(-1px);
    border-color: #d1d5db;
}

.carrier-option:active .carrier-card {
    transform: translateY(0);
}

/* Carrier Radio Selected State */
.carrier-option .carrier-radio:checked + .carrier-card {
    border-color: #2563EB;
    background-color: rgba(37, 99, 235, 0.05);
}

.carrier-option .carrier-radio:checked + .carrier-card .carrier-check {
    border-color: #2563EB;
    background-color: #2563EB;
}

.carrier-option .carrier-radio:checked + .carrier-card .carrier-check-icon {
    display: block;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: button-spin 0.6s linear infinite;
}

.btn-loading span {
    visibility: hidden;
}

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

/* Shake Animation for Error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Pulse Animation for Submit Button */
@keyframes pulse-shadow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

.pulse-shadow {
    animation: pulse-shadow 2s infinite;
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.open {
    max-height: 200px;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

.toast-error {
    background-color: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.toast-success {
    background-color: #D1FAE5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

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

/* Card Hover Effects */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    /* Larger touch targets on mobile */
    .carrier-option .carrier-card {
        min-height: 72px;
    }

    /* Full width buttons */
    button[type="submit"] {
        min-height: 56px;
    }

    /* Better spacing for mobile */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* Print Styles */
@media print {
    header, footer, form {
        display: none;
    }

    body {
        background: white;
    }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    body {
        background: linear-gradient(to bottom right, #1e293b, #0f172a);
    }

    .bg-white {
        background-color: #1e293b;
    }

    .text-gray-800 {
        color: #f1f5f9;
    }

    .text-gray-600 {
        color: #94a3b8;
    }
    */
}

/* Carrier Check Transition */
.carrier-check {
    transition: all 0.2s ease;
}

/* Input Focus Ring */
input:focus {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
