/* 
 * Browser Compatibility CSS
 * Provides fallback styles for browsers that don't support Tailwind CSS
 * and ensures consistent appearance across all browsers
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Utility Classes - Flexbox with fallbacks */
.flex {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.inline-flex {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
}

.items-center {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.justify-center {
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.justify-between {
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

.flex-1 {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 0%;
    flex: 1 1 0%;
}

/* Grid fallback to flexbox for older browsers only — avoids Tailwind conflicts */
@supports not (display: grid) {
    .grid {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .grid-cols-1 > * {
        width: 100%;
    }

    .grid-cols-2 > * {
        width: 50%;
        padding: 0 0.5rem;
    }

    .grid-cols-3 > * {
        width: 33.333%;
        padding: 0 0.5rem;
    }

    .gap-2 { margin: -0.25rem; }
    .gap-2 > * { margin: 0.25rem; }
    .gap-4 { margin: -0.5rem; }
    .gap-4 > * { margin: 0.5rem; }
    .gap-6 { margin: -0.75rem; }
    .gap-6 > * { margin: 0.75rem; }
}

/* Spacing utilities */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }

.m-4 { margin: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }

/* Width utilities */
.w-full { width: 100%; }
.w-16 { width: 4rem; }
.max-w-4xl { max-width: 56rem; }
.min-h-screen { min-height: 100vh; }

/* Border utilities */
.border {
    border: 1px solid #d1d5db;
}

.border-t {
    border-top: 1px solid #e5e7eb;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.rounded-lg {
    -webkit-border-radius: 0.5rem;
    -moz-border-radius: 0.5rem;
    border-radius: 0.5rem;
}

.rounded-xl {
    -webkit-border-radius: 0.75rem;
    -moz-border-radius: 0.75rem;
    border-radius: 0.75rem;
}

.rounded-full {
    -webkit-border-radius: 9999px;
    -moz-border-radius: 9999px;
    border-radius: 9999px;
}

/* Shadow utilities */
.shadow-lg {
    -webkit-box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    -moz-box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-xl {
    -webkit-box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    -moz-box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Background colors */
.bg-white { background-color: #ffffff; }
.bg-blue-600 { background-color: #2563eb; }
.bg-gray-200 { background-color: #e5e7eb; }

/* Text colors */
.text-white { color: #ffffff; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-blue-600 { color: #2563eb; }

/* Text utilities */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Display utilities */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }

/* Outline */
.outline-none {
    outline: 0;
    outline: none;
}

/* Form elements with browser compatibility */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    -webkit-border-radius: 0.5rem;
    -moz-border-radius: 0.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -ms-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    -webkit-box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    -moz-box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button styles */
button,
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-align: center;
    -webkit-border-radius: 0.5rem;
    -moz-border-radius: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    border: none;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    -webkit-box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    -webkit-transform: translateY(-1px);
    -moz-transform: translateY(-1px);
    -ms-transform: translateY(-1px);
    -o-transform: translateY(-1px);
    transform: translateY(-1px);
    -webkit-box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Card component */
.card {
    background: #ffffff;
    -webkit-border-radius: 0.75rem;
    -moz-border-radius: 0.75rem;
    border-radius: 0.75rem;
    padding: 2rem;
    -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive utilities for older browsers */
@media screen and (max-width: 768px) {
    .grid-cols-2 > *,
    .grid-cols-3 > *,
    .md\\:grid-cols-2 > *,
    .md\\:grid-cols-3 > * {
        width: 100%;
        padding: 0;
        margin-bottom: 1rem;
    }
}

/* Space utilities */
.space-y-4 > * + * {
    margin-top: 1rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Transition utilities */
.transition-colors {
    -webkit-transition: color 0.2s ease, background-color 0.2s ease;
    -moz-transition: color 0.2s ease, background-color 0.2s ease;
    -ms-transition: color 0.2s ease, background-color 0.2s ease;
    -o-transition: color 0.2s ease, background-color 0.2s ease;
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* Cursor utilities */
.cursor-pointer {
    cursor: pointer;
}

/* Focus ring utilities */
.focus\\:ring-2:focus {
    outline: none;
    -webkit-box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    -moz-box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Hover utilities */
.hover\\:bg-gray-300:hover {
    background-color: #d1d5db;
}

.hover\\:text-blue-800:hover {
    color: #1e40af;
}

/* Link styles */
a {
    color: #2563eb;
    text-decoration: none;
    -webkit-transition: color 0.2s ease;
    -moz-transition: color 0.2s ease;
    -ms-transition: color 0.2s ease;
    -o-transition: color 0.2s ease;
    transition: color 0.2s ease;
}

a:hover {
    color: #1d4ed8;
}

/* IE10+ specific hacks */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .flex {
        display: -ms-flexbox;
    }
    
    input, select, textarea {
        width: 100%;
    }
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: #000 !important;
        -webkit-box-shadow: none !important;
        -moz-box-shadow: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a, a:visited {
        text-decoration: underline;
    }
}
