/* Plane Orchestrator Custom Styles — Light Theme */

/* ================= Color Tokens ================= */
:root[data-theme="light"] {
    --bg: #ffffff;
    --text: #333;
    --panel: #fff;
    --panel-muted: #f7f7f7;
    --border: #ddd;
    --border-strong: #ccc;
    --focus: #3898ec;
}

:root[data-theme="dark"] {
    --bg: #202020;
    --text: #e5e5e5;
    --panel: #1f1f1f;
    --panel-muted: #252525;
    --border: #3a3a3a;
    --border-strong: #4a4a4a;
    --focus: #62b4ff;
}

/* make sure body inherits the light theme */
html,
body {
    background: var(--bg);
    color: var(--text);
}

/* ========== Custom Scrollbar (light) ========== */
* {
    scrollbar-width: thin;
    scrollbar-color: #c9c9c9 #f0f0f0;
    /* thumb track */
}

*::-webkit-scrollbar {
    width: 14px;
}

*::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 6px;
}

*::-webkit-scrollbar-thumb {
    background-color: #c9c9c9;
    border-radius: 14px;
    border: 3px solid #f0f0f0;
}

/* ========== Animations (unchanged) ========== */

/* Panel slide-in/out */
.panel-enter {
    transform: translateX(100%);
}

.panel-enter-active {
    transform: translateX(0);
    transition: transform 300ms ease-in-out;
}

.panel-exit {
    transform: translateX(0);
}

.panel-exit-active {
    transform: translateX(100%);
    transition: transform 300ms ease-in-out;
}

/* Overlay fade */
.overlay-enter {
    opacity: 0;
}

.overlay-enter-active {
    opacity: 1;
    transition: opacity 200ms ease-in-out;
}

.overlay-exit {
    opacity: 1;
}

.overlay-exit-active {
    opacity: 0;
    transition: opacity 200ms ease-in-out;
}

/* Loading skeleton pulse */
@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .5
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Status indicator pulse */
@keyframes status-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1)
    }

    50% {
        opacity: .8;
        transform: scale(1.05)
    }
}

.status-pulse {
    animation: status-pulse 2s ease-in-out infinite;
}

/* Spin animation */
@keyframes spin {
    from {
        transform: rotate(0)
    }

    to {
        transform: rotate(360deg)
    }
}

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

/* Fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.fade-in {
    animation: fadeIn .3s ease-out;
}

/* Slide up */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.slide-up {
    animation: slideUp .3s ease-out;
}

/* ========== Toast Notifications ========== */
.z-toast {
    z-index: 2147483647;
}

/* max-ish */
.toast-notification {
    word-break: break-word;
    transition: all 300ms ease-in-out;
}

.notification-progress {
    animation: progress 5s linear forwards;
}

@keyframes progress {
    from {
        width: 100%
    }

    to {
        width: 0%
    }
}

/* ========== Custom Components ========== */

/* Card hover effects */
.card-hover {
    transition: all 200ms ease-in-out;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--elev-shadow);
}

/* Button loading state */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus styles (match reference blue) */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ========== Status Badges ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-muted);
    border: 1px solid var(--border);
}

.status-badge-dot {
    width: .5rem;
    height: .5rem;
    margin-right: .375rem;
    border-radius: 9999px;
    background-color: currentColor;
}

/* ========== Service Grid ========== */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* ========== Backend List ========== */
.backend-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 0.5rem;
    transition: all 200ms ease-in-out;
}

.backend-list-item:hover {
    border-color: var(--border);
    background-color: var(--panel-muted);
}

/* ========== Loading States ========== */
.skeleton {
    background: linear-gradient(90deg,
            var(--skeleton-a) 0%,
            var(--skeleton-b) 50%,
            var(--skeleton-a) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* ========== Empty States ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    color: var(--empty-icon);
}

/* ========== Code/Monospace ========== */
code,
pre {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.875rem;
}

pre {
    padding: 1rem;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 0.375rem;
    overflow-x: auto;
    color: var(--text);
}

code {
    padding: 0.125rem 0.25rem;
    background-color: var(--code-inline-bg);
    border-radius: 0.25rem;
    color: var(--code-text);
}

pre code {
    padding: 0;
    background-color: transparent;
    color: inherit;
}

/* ========== Tables ========== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--table-header-bg);
    border-bottom: 1px solid var(--border-strong);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tr:hover td {
    background-color: var(--table-row-hover);
}

/* ========== Responsive Utilities ========== */
@media (max-width: 768px) {
    .service-grid {
        grid-template-columns: 1fr;
    }

    .backend-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ========== Utility Classes ========== */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    * {
        border-width: 2px;
    }
}

/* 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;
    }
}

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

    body {
        background: white;
        color: black;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* ========== Logo Theme Switcher ========== */

/* Logo theme switch using data-theme on <html> */
.logo-dark {
    display: none;
}

/* default to light */

html[data-theme="dark"] .logo-light {
    display: none;
}

html[data-theme="dark"] .logo-dark {
    display: inline-block;
}

.nav-logo {
    height: 3rem;
}

@media (min-width: 640px) {
    .nav-logo {
        height: 3rem;
    }
}
