/* Custom CSS for ACP */

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
    background: #374151;
}

.dark ::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Log viewer styling */
pre {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Table responsive */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Button focus states */
button:focus {
    outline: none;
}

/* Input focus states */
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* Sidebar transition */
.sidebar {
    transition: transform 0.3s ease-in-out;
}

/* Status indicator */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-indicator.running {
    background-color: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.status-indicator.stopped {
    background-color: #ef4444;
}

.status-indicator.unknown {
    background-color: #9ca3af;
}

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

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark .card-hover:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

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

/* Modal backdrop blur */
.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Toast animations */
.toast-enter {
    animation: toast-in 0.3s ease-out;
}

.toast-leave {
    animation: toast-out 0.2s ease-in;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* API Connection Error Overlay */
.api-error-pattern {
    background-image:
        radial-gradient(circle at 25% 25%, rgba(239, 68, 68, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(239, 68, 68, 0.2) 0%, transparent 50%);
    animation: api-error-pattern-shift 8s ease-in-out infinite;
}

@keyframes api-error-pattern-shift {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-10px, -10px);
    }
}

.api-error-icon {
    animation: api-error-icon-shake 2s ease-in-out infinite;
}

@keyframes api-error-icon-shake {
    0%, 100% {
        transform: rotate(0deg);
    }
    10%, 30%, 50% {
        transform: rotate(-5deg);
    }
    20%, 40% {
        transform: rotate(5deg);
    }
    60% {
        transform: rotate(0deg);
    }
}

/* Pulse animation for the error ring */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-ping {
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ==================
   Mobile Responsive Utilities
   ================== */

/* iOS Input Zoom Prevention - prevents zoom on focus for inputs on iOS */
@media screen and (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Touch-friendly minimum sizes (Apple HIG recommends 44x44px) */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* Mobile menu transitions */
.mobile-menu-enter {
    transform: translateX(-100%);
}

.mobile-menu-enter-active {
    transform: translateX(0);
    transition: transform 0.3s ease-out;
}

.mobile-menu-leave-active {
    transform: translateX(-100%);
    transition: transform 0.2s ease-in;
}

/* Mobile backdrop fade */
.mobile-backdrop {
    transition: opacity 0.3s ease-out;
}

/* Table scroll container with fade indicator */
.table-scroll-container {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.9));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.table-scroll-container.has-scroll::after {
    opacity: 1;
}

.dark .table-scroll-container::after {
    background: linear-gradient(to right, transparent, rgba(31, 41, 55, 0.9));
}

/* Mobile card styles for table alternatives */
.mobile-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.dark .mobile-card {
    background: #1f2937;
}

.mobile-card-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .mobile-card-label {
    color: #9ca3af;
}

.mobile-card-value {
    font-size: 0.875rem;
    color: #111827;
    margin-top: 0.25rem;
}

.dark .mobile-card-value {
    color: #f9fafb;
}

/* Responsive button stacking */
@media screen and (max-width: 639px) {
    .btn-stack {
        flex-direction: column;
        width: 100%;
    }

    .btn-stack > * {
        width: 100%;
        justify-content: center;
    }
}

/* Hide scrollbar but keep functionality for mobile horizontal scroll */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .safe-area-inset-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .safe-area-inset-top {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}
