/* Custom styles for Hyperautomatisation Blog */

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gray-700 {
        color: #000 !important;
    }
    .bg-gray-100 {
        background-color: #fff !important;
        border: 2px solid #000 !important;
    }
}

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

/* Focus indicators */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #FF6B35;
    outline-offset: 2px;
}

/* Skip link specific styles */
.skip-link:focus {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    background: #FF6B35;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: bold;
}

/* Language selector improvements */
#language-selector {
    min-width: 80px;
    position: relative;
    z-index: 10;
}

#current-language {
    color: #1f2937 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#language-selector:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: #f3f4f6 !important;
}

#language-selector:hover #current-language {
    color: #FF6B35 !important;
}

#language-dropdown {
    min-width: 150px;
    z-index: 1000 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    border: 2px solid #e5e7eb !important;
}

.language-dropdown-item {
    transition: all 0.2s ease;
}

#language-dropdown button:hover {
    background-color: #f3f4f6;
    transform: translateX(2px);
}

.language-dropdown-item {
    transition: all 0.2s ease;
    min-height: 40px;
    display: flex !important;
    align-items: center !important;
}

.language-dropdown-item span {
    color: #374151 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin-left: 8px;
}

.language-dropdown-item i {
    font-size: 16px !important;
    width: 20px;
    display: inline-block;
}

#language-dropdown {
    background: white !important;
    padding: 8px 0 !important;
}

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

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #e55a2b;
}

/* Animation classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-in-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Code blocks styling */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
    margin: 20px 0;
    position: relative;
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
    border-radius: 8px 8px 0 0;
}

.code-comment {
    color: #94a3b8;
    font-style: italic;
}

.code-keyword {
    color: #f472b6;
    font-weight: bold;
}

.code-string {
    color: #34d399;
}

/* Architecture diagram styling */
.architecture-step {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.architecture-step:hover {
    transform: translateY(-4px);
    border-color: #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.2);
}

/* Mobile menu */
.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

.mobile-menu a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mobile-menu a:hover {
    color: #FF6B35;
}

.mobile-menu a:last-child {
    border-bottom: none;
}

/* Mobile-first improvements */
.mobile-optimized {
    -webkit-tap-highlight-color: rgba(255, 107, 53, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

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

/* Better font rendering on mobile */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Enhanced mobile compatibility */
@media (max-width: 480px) {
    /* Extra small devices */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
    
    .py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Language selector adjustments */
    #language-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        right: auto !important;
        min-width: 200px !important;
        z-index: 100 !important;
    }
}

@media (max-width: 360px) {
    /* Very small devices */
    .px-6 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .space-x-4 > :not([hidden]) ~ :not([hidden]) {
        margin-left: 0.5rem !important;
    }
    
    button, .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .py-20 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .hero-section {
        min-height: auto !important;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    button, 
    a[role="button"],
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    .hover\:bg-gray-100:hover,
    .hover\:bg-gray-200:hover,
    .hover\:text-uipath-primary:hover {
        /* Remove hover effects on touch devices */
        background-color: inherit;
        color: inherit;
    }
    
    /* Better tap targets */
    nav a {
        padding: 0.75rem 1rem;
    }
    
    .mobile-menu a {
        padding: 1rem 0;
        font-size: 1.125rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp images on retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .bg-white {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .text-gray-700 {
        color: #d1d5db;
    }
    
    .bg-gray-100 {
        background-color: #374151;
    }
    
    .border-gray-200 {
        border-color: #4b5563;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    h1 {
        font-size: 24pt;
    }
    
    h2 {
        font-size: 18pt;
    }
    
    h3 {
        font-size: 16pt;
    }
    
    .bg-gradient-to-br,
    .bg-gradient-to-r {
        background: white !important;
        color: black !important;
    }
    
    .text-white {
        color: black !important;
    }
    
    .shadow-lg,
    .shadow-xl {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
    }
}

/* Additional UiPath branding */
.gradient-text {
    background: linear-gradient(135deg, #FF6B35, #e55a2b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.card-hover {
    transition: all 0.3s ease;
}

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

/* Mobile menu improvements */
@media (max-width: 768px) {
    .mobile-menu {
        display: none;
    }
    
    .mobile-menu.active {
        display: block;
        animation: slideDown 0.3s ease-in-out;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
}