/* Conversion System Brand Styles */

/* Import Poppins Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* Brand Color Variables */
:root {
    --ghost-white: #F8F9FA;
    --orange-primary: #E05E0F;
    --orange-dark: #c54d0a;
    --orange-light: #ff7c2a;
    --teal-primary: #4D9A88;
    --teal-dark: #3a7869;
    --teal-light: #6bb5a3;
    --deep-blue: #172B42;
    --deep-blue-light: #2a4563;
    --text-primary: #172B42;
    --text-secondary: #4a5568;
    --text-light: #718096;
}

/* Global Font */
* {
    font-family: 'Poppins', sans-serif;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--ghost-white);
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Utility classes */
.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.3s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Glass effect */
.glass-effect {
    background: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Brand Gradient backgrounds */
.gradient-orange {
    background: linear-gradient(135deg, var(--orange-primary) 0%, var(--orange-light) 100%);
}

.gradient-teal {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-light) 100%);
}

.gradient-brand {
    background: linear-gradient(135deg, var(--orange-primary) 0%, var(--teal-primary) 100%);
}

.gradient-deep {
    background: linear-gradient(135deg, var(--deep-blue) 0%, var(--deep-blue-light) 100%);
}

/* Brand Text Colors */
.text-orange { color: var(--orange-primary); }
.text-teal { color: var(--teal-primary); }
.text-deep-blue { color: var(--deep-blue); }

/* Brand Background Colors */
.bg-ghost-white { background-color: var(--ghost-white); }
.bg-orange { background-color: var(--orange-primary); }
.bg-teal { background-color: var(--teal-primary); }
.bg-deep-blue { background-color: var(--deep-blue); }

/* Score indicators with brand colors */
.score-high { color: var(--teal-primary); }
.score-medium { color: var(--orange-primary); }
.score-low { color: #ef4444; }

.score-bg-high { background-color: var(--teal-primary); }
.score-bg-medium { background-color: var(--orange-primary); }
.score-bg-low { background-color: #ef4444; }

/* Progress bars */
.progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange-primary) 0%, var(--teal-primary) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Cards with brand styling */
.metric-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(23, 43, 66, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(77, 154, 136, 0.1);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(23, 43, 66, 0.15);
    border-color: var(--teal-primary);
}

/* Brand Buttons */
.btn-primary {
    background: var(--orange-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--orange-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(224, 94, 15, 0.3);
}

.btn-secondary {
    background: var(--teal-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--teal-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 154, 136, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--orange-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid var(--orange-primary);
    cursor: pointer;
}

.btn-outline:hover {
    background: var(--orange-primary);
    color: white;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--deep-blue);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Report sections */
.report-section {
    margin-bottom: 32px;
    padding: 32px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(23, 43, 66, 0.1);
    border: 1px solid rgba(77, 154, 136, 0.1);
}

.report-header {
    border-bottom: 2px solid var(--teal-primary);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

/* Status badges with brand colors */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.critical {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.status-badge.warning {
    background: rgba(224, 94, 15, 0.1);
    color: var(--orange-primary);
}

.status-badge.success {
    background: rgba(77, 154, 136, 0.1);
    color: var(--teal-primary);
}

.status-badge.info {
    background: rgba(23, 43, 66, 0.1);
    color: var(--deep-blue);
}

/* Navigation styles */
.nav-brand {
    background: white;
    border-bottom: 1px solid rgba(77, 154, 136, 0.1);
}

.nav-link {
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--orange-primary);
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, var(--deep-blue) 0%, var(--deep-blue-light) 100%);
    color: white;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    .print-break {
        page-break-before: always;
    }

    body {
        font-size: 12pt;
    }

    .gradient-brand {
        background: var(--orange-primary) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ======================
   RESPONSIVE DESIGN
   ====================== */

/* Mobile First Approach - Base styles for mobile */
.container {
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

/* Touch-friendly sizing */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Tablet Styles - 768px and up */
@media (min-width: 768px) {
    .container {
        max-width: 750px;
    }

    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .md\:flex {
        display: flex;
    }

    .md\:hidden {
        display: none;
    }

    .md\:block {
        display: block;
    }
}

/* Desktop Styles - 1024px and up */
@media (min-width: 1024px) {
    .container {
        max-width: 970px;
    }

    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .lg\:flex {
        display: flex;
    }

    .lg\:hidden {
        display: none;
    }

    .lg\:block {
        display: block;
    }
}

/* Large Desktop - 1280px and up */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }

    .xl\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .xl\:grid-cols-5 {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Extra Large Desktop - 1536px and up */
@media (min-width: 1536px) {
    .container {
        max-width: 1400px;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 767px) {
    /* Navigation */
    .mobile-menu-toggle {
        display: block;
    }

    nav .desktop-menu {
        display: none;
    }

    /* Typography scaling */
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Forms */
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Buttons */
    .btn-primary, .btn-secondary, .btn-outline {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
    }

    /* Cards and sections */
    .metric-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .report-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    /* Tables - make them scrollable */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 500px;
    }

    /* Hero section */
    .hero-section {
        padding: 40px 20px;
    }

    /* Footer */
    footer {
        padding: 40px 20px;
    }

    /* Modals */
    .modal {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Grid to stack */
    .grid {
        grid-template-columns: 1fr !important;
    }

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }

    /* Padding adjustments */
    .px-8 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .py-24 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Text size adjustments */
    .text-6xl {
        font-size: 2.5rem;
    }

    .text-5xl {
        font-size: 2rem;
    }

    .text-4xl {
        font-size: 1.75rem;
    }

    .text-3xl {
        font-size: 1.5rem;
    }

    /* Spacing adjustments */
    .space-y-4 > * + * {
        margin-top: 1rem;
    }

    .gap-8 {
        gap: 1rem;
    }

    .gap-6 {
        gap: 0.75rem;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Navigation */
    nav {
        padding: 0 24px;
    }

    /* Cards */
    .metric-card {
        padding: 20px;
    }

    /* Typography */
    h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 2rem;
    }

    /* Buttons */
    .btn-group {
        display: flex;
        gap: 1rem;
    }

    .btn-group .btn-primary,
    .btn-group .btn-secondary {
        flex: 1;
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    /* Reduce vertical padding */
    .hero-section {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    nav {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* Adjust modal height */
    .modal {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Loading spinner with brand color */
.spinner {
    border: 3px solid var(--ghost-white);
    border-top: 3px solid var(--orange-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* Chart styles */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Table styles with brand colors */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--ghost-white);
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--teal-primary);
    color: var(--deep-blue);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--ghost-white);
}

.data-table tr:hover {
    background: var(--ghost-white);
}

/* Form elements with brand colors */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--teal-primary);
    border-color: var(--teal-primary);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ======================
   BROWSER COMPATIBILITY
   ====================== */

/* Custom scrollbar with fallbacks */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--ghost-white);
}

::-webkit-scrollbar-thumb {
    background: var(--teal-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--teal-dark);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--teal-primary) var(--ghost-white);
}

/* IE11 and Edge Legacy fallbacks */
@supports (-ms-ime-align: auto) {
    /* Edge specific styles */
    .container {
        max-width: 100%;
    }
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
    /* Safari only styles */
    input, textarea, select {
        -webkit-appearance: none;
        appearance: none;
    }

    /* Fix Safari's button styling */
    button {
        -webkit-appearance: button;
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    /* Firefox only styles */
    input[type="number"] {
        -moz-appearance: textfield;
    }
}

/* Cross-browser compatibility */
/* Flexbox prefixes */
.flex {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.flex-wrap {
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.justify-center {
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.align-center {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

/* Grid prefixes for older browsers */
@supports not (display: grid) {
    .responsive-grid {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .responsive-grid > * {
        -webkit-box-flex: 1;
        -ms-flex: 1 1 100%;
        flex: 1 1 100%;
    }
}

/* Transform prefixes */
.transform {
    -webkit-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}

/* Transition prefixes */
.transition-all {
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* Box shadow prefixes */
.shadow {
    -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Backdrop filter for older browsers */
@supports not (backdrop-filter: blur(10px)) {
    .glass-effect {
        background: rgba(248, 249, 250, 0.98);
    }
}

/* Sticky positioning fallback */
@supports not (position: sticky) {
    nav {
        position: fixed;
        top: 0;
        width: 100%;
    }

    body {
        padding-top: 80px;
    }
}

/* CSS Variables fallback for IE11 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* IE11 specific styles - use hard-coded values instead of variables */
    body {
        background-color: #F8F9FA;
        color: #172B42;
    }

    .btn-primary {
        background: #E05E0F;
    }

    .btn-secondary {
        background: #4D9A88;
    }
}

/* Accessibility improvements */
/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--orange-primary);
    outline-offset: 2px;
}

/* Remove focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary,
    .btn-secondary {
        border: 2px solid currentColor;
    }

    .metric-card {
        border: 2px solid currentColor;
    }
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --ghost-white: #1a1a1a;
        --text-primary: #f0f0f0;
        --text-secondary: #b0b0b0;
    }

    body {
        background-color: #0a0a0a;
        color: #f0f0f0;
    }

    .metric-card {
        background: #1a1a1a;
        border-color: rgba(77, 154, 136, 0.3);
    }

    .glass-effect {
        background: rgba(26, 26, 26, 0.95);
    }
}

/* Logo styles */
.brand-logo {
    height: 40px;
    width: auto;
}

/* Typography with Poppins */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--deep-blue);
}

p {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Links with brand colors */
a {
    color: var(--orange-primary);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--orange-dark);
}

/* ======================
   TOUCH & MOBILE OPTIMIZATIONS
   ====================== */

/* Disable hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .metric-card:hover {
        transform: none;
        box-shadow: 0 4px 6px rgba(23, 43, 66, 0.1);
    }

    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-outline:hover {
        transform: none;
    }

    /* Add active states for touch feedback */
    .btn-primary:active,
    .btn-secondary:active,
    .btn-outline:active {
        transform: scale(0.95);
    }
}

/* Improve tap targets for mobile */
@media (pointer: coarse) {
    button, a, input, select, textarea {
        min-height: 44px;
        padding: 12px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Prevent font size adjustment */
    body {
        -webkit-text-size-adjust: 100%;
    }

    /* Fix iOS button styling */
    button,
    input[type="submit"],
    input[type="button"] {
        -webkit-appearance: none;
        border-radius: 0;
    }

    /* Fix iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px;
    }

    /* Smooth scrolling on iOS */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* Android-specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* Android specific styles if needed */
    select {
        background-image: none;
    }
}

/* ======================
   PERFORMANCE OPTIMIZATIONS
   ====================== */

/* Hardware acceleration for animations */
.animate-fadeIn,
.animate-slideIn,
.transition-all {
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

/* Optimize font loading */
@font-face {
    font-family: 'Poppins';
    font-display: swap; /* Show fallback font while loading */
}

/* Lazy loading images */
img[loading="lazy"] {
    background: var(--ghost-white);
}

/* ======================
   UTILITY CLASSES
   ====================== */

/* Hide elements responsively */
.hidden-mobile {
    @media (max-width: 767px) {
        display: none !important;
    }
}

.hidden-tablet {
    @media (min-width: 768px) and (max-width: 1023px) {
        display: none !important;
    }
}

.hidden-desktop {
    @media (min-width: 1024px) {
        display: none !important;
    }
}

/* Visible only on specific devices */
.visible-mobile {
    display: none !important;
    @media (max-width: 767px) {
        display: block !important;
    }
}

.visible-tablet {
    display: none !important;
    @media (min-width: 768px) and (max-width: 1023px) {
        display: block !important;
    }
}

.visible-desktop {
    display: none !important;
    @media (min-width: 1024px) {
        display: block !important;
    }
}

/* Safe area insets for modern phones */
@supports (padding: max(0px)) {
    .safe-area-inset {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}