/* Custom CSS for TorGuide - Enhanced styling and animations */

/* Remove unwanted focus/outline effects on all interactive elements */
a, button, input, textarea, select {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-focus-ring-color: transparent !important;
}

a:focus, button:focus, input:focus, textarea:focus, select:focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: inherit !important;
}

/* Remove focus ring on navigation links */
nav a:focus, nav button:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Remove focus effects on all clickable elements */
*:focus {
    outline: none !important;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced category card hover effects */
.category-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(104, 211, 145, 0.15), transparent);
    transition: left 0.7s ease-in-out;
    z-index: 1;
}

.category-card:hover::before {
    left: 100%;
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
}

/* Enhanced keyboard navigation styles */
.category-card.keyboard-focused {
    @apply ring-2 ring-blue-500 bg-blue-900/20 scale-105 shadow-lg;
    transition: all 0.2s ease-in-out;
}

.category-card:focus-visible {
    @apply ring-2 ring-blue-500 outline-none;
}

/* Advanced button animations */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease-in-out;
}

.btn-glow:hover::after {
    left: 100%;
}

/* Pulse animation for online status */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.animate-pulse {
    animation: pulse-glow 2s infinite;
}

/* Enhanced loading animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Floating background elements */
@keyframes float-slow {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

@keyframes float-fast {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(-180deg);
    }
}

.float-slow {
    animation: float-slow 6s ease-in-out infinite;
}

.float-fast {
    animation: float-fast 4s ease-in-out infinite;
}

/* Table row animations - DISABLED FOR ADMIN PAGES */
tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Only apply hover effects on non-admin pages */
body:not(.admin-page) tbody tr:hover {
    transform: translateX(8px);
    background: linear-gradient(90deg, rgba(104, 211, 145, 0.1), transparent);
}

/* Disable table hover effects for admin pages */
body.admin-page tbody tr:hover {
    transform: none !important;
    background: inherit !important;
}

/* Custom scrollbar enhanced */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #68d391, #48bb78);
    border-radius: 5px;
    border: 2px solid #161b22;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #f6ad55, #ed8936);
}

/* Enhanced scrollbar for table container */
.table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #68d391, #48bb78);
    border-radius: 4px;
    border: 1px solid #161b22;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #f6ad55, #ed8936);
}

.table-container::-webkit-scrollbar-corner {
    background: #161b22;
}

/* Enhanced scrollbar for all overflow containers */
.overflow-auto::-webkit-scrollbar,
.overflow-scroll::-webkit-scrollbar,
.overflow-x-auto::-webkit-scrollbar,
.overflow-y-auto::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.overflow-auto::-webkit-scrollbar-track,
.overflow-scroll::-webkit-scrollbar-track,
.overflow-x-auto::-webkit-scrollbar-track,
.overflow-y-auto::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 4px;
}

.overflow-auto::-webkit-scrollbar-thumb,
.overflow-scroll::-webkit-scrollbar-thumb,
.overflow-x-auto::-webkit-scrollbar-thumb,
.overflow-y-auto::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #68d391, #48bb78);
    border-radius: 4px;
    border: 1px solid #161b22;
}

.overflow-auto::-webkit-scrollbar-thumb:hover,
.overflow-scroll::-webkit-scrollbar-thumb:hover,
.overflow-x-auto::-webkit-scrollbar-thumb:hover,
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f6ad55, #ed8936);
}

/* Glass morphism enhanced */
.glass-effect {
    backdrop-filter: blur(20px);
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid rgba(104, 211, 145, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Focus states enhanced */
button:focus,
a:focus {
    outline: 2px solid #68d391;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(104, 211, 145, 0.2);
}

/* Enhanced search input styles */
#search-input:focus {
    @apply ring-2 ring-tor-green border-tor-green;
    box-shadow: 0 0 20px rgba(104, 211, 145, 0.3);
}

/* Link row hover and focus styles - DISABLED FOR ADMIN PAGES */
body:not(.admin-page) .link-row:hover {
    background-color: rgba(31, 41, 55, 0.5);
    transform: translateX(4px);
    transition: all 0.2s ease-in-out;
}

/* Disable link row hover effects for admin pages */
body.admin-page .link-row:hover {
    background-color: inherit !important;
    transform: none !important;
}

.link-row a:focus {
    outline: 2px solid #68d391;
    border-radius: 0.375rem;
    box-shadow: 0 0 10px rgba(104, 211, 145, 0.5);
}

/* Breadcrumb animation */
#breadcrumbs {
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search clear button animation */
#search-clear {
    transition: all 0.2s ease-in-out;
}

#search-clear:hover {
    transform: scale(1.1);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Keyboard shortcuts panel */
#keyboard-shortcuts {
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Enhanced table hover effects */
.link-row td {
    transition: all 0.2s ease-in-out;
}

.link-row:hover td:first-child {
    @apply text-tor-green;
}

.link-row:hover .badge {
    @apply scale-105;
}

/* Smooth transitions for all interactive elements */
.category-card, .link-row, button, input {
    transition: all 0.2s ease-in-out;
}

/* Focus trap for accessibility */
.focus-trap {
    @apply ring-2 ring-offset-2 ring-tor-green ring-offset-gray-900;
}

/* Search results highlighting */
.search-highlight {
    @apply bg-yellow-400 text-black px-1 rounded;
}

/* Status indicators */
.status-indicator {
    @apply inline-block w-2 h-2 rounded-full mr-2;
}

.status-online {
    @apply bg-green-500;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.status-offline {
    @apply bg-red-500;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.status-unknown {
    @apply bg-yellow-500;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

/* Enhanced scrollbar for search area */
.search-container::-webkit-scrollbar {
    width: 6px;
}

.search-container::-webkit-scrollbar-track {
    @apply bg-gray-800 rounded;
}

.search-container::-webkit-scrollbar-thumb {
    @apply bg-tor-green rounded;
}

.search-container::-webkit-scrollbar-thumb:hover {
    @apply bg-tor-orange;
}

/* Pulse animation for notifications */
.notification-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Category card enhanced hover */
.category-card:hover .category-icon {
    transform: scale(1.2) rotate(5deg);
}

.category-card:hover .category-count {
    @apply text-tor-green;
}

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Mobile optimizations enhanced */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.25rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .category-card {
        padding: 1rem;
    }
    
    .category-card .w-16.h-16 {
        width: 3rem;
        height: 3rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
    
    .category-card.keyboard-focused {
        @apply scale-102;
    }
    
    .link-row:hover {
        transform: none;
    }
}

/* Dark theme enhancements */
.dark-glow {
    box-shadow: 0 4px 20px rgba(104, 211, 145, 0.15);
}

.dark-glow:hover {
    box-shadow: 0 8px 40px rgba(104, 211, 145, 0.25);
}

/* Advanced transitions */
.transition-all-smooth {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Filter effects */
.filter-blur-sm {
    filter: blur(2px);
}

.filter-none {
    filter: none;
}

/* Category selection state */
.category-selected {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.3), rgba(72, 187, 120, 0.2));
    border-color: #68d391;
    transform: scale(1.05);
}

/* Link row filtering animation */
.link-row {
    transition: all 0.3s ease-in-out;
}

.link-row.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Enhanced notification styles */
.notification {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(104, 211, 145, 0.3);
}

/* Print styles enhanced */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .bg-gradient-to-r {
        background: #333 !important;
        color: white !important;
    }
    
    .category-card, .search-container, #keyboard-shortcuts {
        display: none !important;
    }
    
    .link-row {
        @apply text-black bg-white;
        break-inside: avoid;
    }
}

/* Performance optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .category-card {
        @apply border-2 border-white;
    }
    
    .link-row {
        @apply border-b border-gray-600;
    }
}

/* Table scroll fix */
.table-container {
    overflow: hidden;
}

.table-container table {
    table-layout: fixed;
    width: 100%;
}

.table-container td,
.table-container th {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-container td:nth-child(2) {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Compact table styling */
.table-container .link-row td {
    padding-left: 1rem;
    padding-right: 1rem;
}

.table-container .link-row td:nth-child(4),
.table-container .link-row td:nth-child(5) {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.table-container .link-row td:last-child a {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.table-container .link-row td:last-child a i {
    margin-right: 0.25rem;
}

/* Status and Trust badges styling */
.table-container .link-row td:nth-child(4) span,
.table-container .link-row td:nth-child(5) span {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    min-width: fit-content;
}

.table-container .link-row td:nth-child(4) i,
.table-container .link-row td:nth-child(5) i {
    margin-right: 0.25rem;
    font-size: 0.625rem;
}

/* Enhanced Show All button */
.category-card[onclick="resetAllFilters()"] {
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.1), rgba(246, 173, 85, 0.1));
    border: 1px solid rgba(104, 211, 145, 0.3);
    position: relative;
    overflow: hidden;
}

.category-card[onclick="resetAllFilters()"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(104, 211, 145, 0.2), transparent);
    transition: left 0.6s ease-in-out;
    z-index: 1;
}

.category-card[onclick="resetAllFilters()"] > * {
    position: relative;
    z-index: 2;
}

.category-card[onclick="resetAllFilters()"]hover::before {
    left: 100%;
}

/* FAQ Page Specific Styles */
.faq-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.faq-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(104, 211, 145, 0.1), transparent);
    transition: left 0.8s ease-in-out;
    z-index: 1;
}

.faq-item:hover::before {
    left: 100%;
}

.faq-toggle {
    transition: all 0.2s ease-in-out;
    position: relative;
    z-index: 2;
}

.faq-toggle:hover h3 {
    color: #68d391;
}

.faq-content {
    transition: all 0.3s ease-in-out;
    transform-origin: top;
}

.faq-content.hidden {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    transform: scaleY(0);
}

.faq-content:not(.hidden) {
    opacity: 1;
    max-height: 1000px;
    transform: scaleY(1);
    animation: fadeInDown 0.4s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scaleY(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

/* FAQ Category Cards */
.faq-item .w-12.h-12 {
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.faq-item .w-12.h-12::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(104, 211, 145, 0.2), rgba(246, 173, 85, 0.2));
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    border-radius: inherit;
}

.faq-toggle:hover .w-12.h-12::before {
    opacity: 1;
}

.faq-toggle:hover .w-12.h-12 i {
    transform: scale(1.1) rotate(5deg);
}

/* FAQ Enhanced Grid Styling */
.faq-content .grid {
    gap: 1rem;
}

.faq-content .bg-tor-darker\/50 {
    transition: all 0.2s ease-in-out;
    border-radius: 0.75rem;
    position: relative;
    overflow: hidden;
}

.faq-content .bg-tor-darker\/50::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(104, 211, 145, 0.1), rgba(246, 173, 85, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.faq-content .bg-tor-darker\/50:hover::before {
    opacity: 1;
}

.faq-content .bg-tor-darker\/50:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(104, 211, 145, 0.15);
}

/* FAQ Trust Badges Enhanced */
.faq-content .bg-blue-900\/30,
.faq-content .bg-orange-900\/30,
.faq-content .bg-red-900\/30,
.faq-content .bg-green-600\/20,
.faq-content .bg-red-600\/20 {
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.faq-content .bg-blue-900\/30::before,
.faq-content .bg-orange-900\/30::before,
.faq-content .bg-red-900\/30::before,
.faq-content .bg-green-600\/20::before,
.faq-content .bg-red-600\/20::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.faq-content .bg-blue-900\/30:hover::before,
.faq-content .bg-orange-900\/30:hover::before,
.faq-content .bg-red-900\/30:hover::before,
.faq-content .bg-green-600\/20:hover::before,
.faq-content .bg-red-600\/20:hover::before {
    opacity: 1;
}

.faq-content .bg-blue-900\/30:hover i,
.faq-content .bg-orange-900\/30:hover i,
.faq-content .bg-red-900\/30:hover i,
.faq-content .bg-green-600\/20:hover i,
.faq-content .bg-red-600\/20:hover i {
    transform: scale(1.2);
}

/* FAQ Installation Steps */
.faq-content ol li {
    transition: all 0.2s ease-in-out;
}

.faq-content ol li:hover {
    transform: translateX(4px);
}

.faq-content ol li span:first-child {
    transition: all 0.2s ease-in-out;
}

.faq-content ol li:hover span:first-child {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(104, 211, 145, 0.3);
}

/* FAQ Check/Cross Lists */
.faq-content .fas.fa-check {
    transition: all 0.2s ease-in-out;
}

.faq-content .fas.fa-times {
    transition: all 0.2s ease-in-out;
}

.faq-content .space-y-3 > div:hover .fas.fa-check {
    transform: scale(1.2);
    color: #68d391;
    filter: drop-shadow(0 0 4px rgba(104, 211, 145, 0.6));
}

.faq-content .space-y-3 > div:hover .fas.fa-times {
    transform: scale(1.2);
    color: #ef4444;
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.6));
}

/* FAQ Category Filter Icons */
.faq-content .grid.grid-cols-2 .bg-tor-darker\/50 i {
    transition: all 0.3s ease-in-out;
}

.faq-content .grid.grid-cols-2 .bg-tor-darker\/50:hover i {
    transform: scale(1.3) rotate(10deg);
    filter: drop-shadow(0 0 8px currentColor);
}

/* FAQ Help Section Enhanced */
.faq-item:last-of-type + div .bg-gradient-to-br {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.9), 
        rgba(13, 17, 23, 0.9)
    );
    backdrop-filter: blur(20px);
    border: 1px solid rgba(104, 211, 145, 0.2);
}

.faq-item:last-of-type + div .w-20.h-20 {
    animation: float-slow 6s ease-in-out infinite;
}

/* Mobile FAQ Optimizations */
@media (max-width: 768px) {
    .faq-toggle {
        padding: 1.5rem 1rem;
    }
    
    .faq-toggle h3 {
        font-size: 1.125rem;
        line-height: 1.4;
    }
    
    .faq-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .faq-content .pl-16 {
        padding-left: 1rem;
    }
    
    .faq-content .grid {
        grid-template-columns: 1fr;
    }
    
    .faq-item .w-12.h-12 {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .faq-item .w-12.h-12 i {
        font-size: 1rem;
    }
}

/* FAQ Accessibility Enhancements */
.faq-toggle:focus {
    outline: 2px solid #68d391;
    outline-offset: 2px;
    border-radius: 1rem;
}

.faq-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(104, 211, 145, 0.2);
}

/* FAQ Performance Optimizations */
.faq-item,
.faq-toggle,
.faq-content {
    will-change: transform;
    backface-visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .faq-item,
    .faq-toggle,
    .faq-content,
    .faq-item::before,
    .faq-content .bg-tor-darker\/50,
    .faq_content ol li {
        transition: none !important;
        animation: none !important;
    }
}
