/* Arix Dashboard — Custom Styles */

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgb(30 41 59); /* slate-800 */
}
::-webkit-scrollbar-thumb {
    background: rgb(71 85 105); /* slate-600 */
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgb(100 116 139); /* slate-500 */
}

/* Nav active state */
.nav-link.active {
    background-color: rgb(30 41 59);
    color: white;
    border-right: 2px solid rgb(59 130 246);
}

/* Status dot animation */
.status-pulse {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Card style */
.dash-card {
    background-color: rgb(30 41 59); /* slate-800 */
    border: 1px solid rgb(51 65 85); /* slate-700 */
    border-radius: 0.5rem;
    padding: 1.25rem;
    overflow: hidden;
    min-width: 0; /* Allow flex children to shrink below content size */
}

/* Ensure text doesn't overflow cards */
.dash-card p,
.dash-card span {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Truncate long paths/text with ellipsis */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 100%;
}

/* Progress bar */
.progress-bar {
    height: 6px;
    border-radius: 3px;
    background-color: rgb(51 65 85);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    background-color: rgb(59 130 246);
    transition: width 0.3s ease;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge-green {
    background-color: rgb(20 83 45 / 0.4);
    color: rgb(74 222 128);
}
.badge-red {
    background-color: rgb(127 29 29 / 0.4);
    color: rgb(248 113 113);
}
.badge-yellow {
    background-color: rgb(113 63 18 / 0.4);
    color: rgb(250 204 21);
}
.badge-gray {
    background-color: rgb(51 65 85 / 0.5);
    color: rgb(148 163 184);
}

/* Code/log viewer */
.log-viewer {
    background-color: rgb(15 23 42); /* slate-950 */
    border: 1px solid rgb(51 65 85);
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 600px;
    overflow-y: auto;
}

/* Table styles */
.dash-table {
    width: 100%;
    border-collapse: collapse;
}
.dash-table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(148 163 184); /* slate-400 */
    border-bottom: 1px solid rgb(51 65 85);
}
.dash-table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgb(51 65 85 / 0.5);
}
.dash-table tr:hover td {
    background-color: rgb(30 41 59 / 0.5);
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}
.btn-primary {
    background-color: rgb(59 130 246);
    color: white;
}
.btn-primary:hover {
    background-color: rgb(37 99 235);
}
.btn-danger {
    background-color: rgb(127 29 29 / 0.6);
    color: rgb(248 113 113);
}
.btn-danger:hover {
    background-color: rgb(153 27 27 / 0.8);
}
.btn-secondary {
    background-color: rgb(51 65 85);
    color: rgb(203 213 225);
}
.btn-secondary:hover {
    background-color: rgb(71 85 105);
}
.btn-success {
    background-color: rgb(20 83 45 / 0.7);
    color: rgb(74 222 128);
}
.btn-success:hover {
    background-color: rgb(20 83 45);
}
.btn-warning {
    background-color: rgb(113 63 18 / 0.7);
    color: rgb(250 204 21);
}
.btn-warning:hover {
    background-color: rgb(113 63 18);
}
.btn-loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

/* Form inputs */
.form-input {
    background-color: rgb(15 23 42);
    border: 1px solid rgb(51 65 85);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: rgb(226 232 240);
    width: 100%;
    outline: none;
}
.form-input:focus {
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 1px rgb(59 130 246 / 0.3);
}

.form-select {
    background-color: rgb(15 23 42);
    border: 1px solid rgb(51 65 85);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: rgb(226 232 240);
    width: 100%;
    outline: none;
    appearance: auto;
}
.form-select:focus {
    border-color: rgb(59 130 246);
}

/* Tabs */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(148 163 184);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab-btn:hover {
    color: rgb(226 232 240);
}
.tab-btn.active {
    color: rgb(59 130 246);
    border-bottom-color: rgb(59 130 246);
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal-content {
    background-color: rgb(30 41 59);
    border: 1px solid rgb(51 65 85);
    border-radius: 0.5rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 480px;
}

/* Wizard step dots */
.sched-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgb(51 65 85);
    color: rgb(148 163 184);
    transition: all 0.2s ease;
}
.sched-step-dot.active {
    background: rgb(59 130 246);
    color: white;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}
.toast-success {
    background-color: rgb(20 83 45);
    color: rgb(74 222 128);
    border: 1px solid rgb(34 197 94 / 0.3);
}
.toast-error {
    background-color: rgb(127 29 29);
    color: rgb(248 113 113);
    border: 1px solid rgb(239 68 68 / 0.3);
}
@keyframes slideUp {
    from { transform: translateY(1rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---- Logs Page ---- */

/* Session category indicators */
.session-item {
    border-left: 3px solid transparent;
}
.session-core {
    border-left-color: rgb(59 130 246); /* blue-500 */
}
.session-dev {
    border-left-color: rgb(234 179 8); /* yellow-500 */
}
.session-test {
    border-left-color: rgb(71 85 105); /* slate-600 */
    opacity: 0.7;
}
.session-test:hover {
    opacity: 1;
}

/* Log entry type badges */
.log-badge-event {
    background-color: rgb(59 130 246 / 0.15);
    color: rgb(96 165 250); /* blue-400 */
}
.log-badge-fact {
    background-color: rgb(34 197 94 / 0.15);
    color: rgb(74 222 128); /* green-400 */
}
.log-badge-insight {
    background-color: rgb(168 85 247 / 0.15);
    color: rgb(192 132 252); /* purple-400 */
}
.log-badge-task {
    background-color: rgb(234 179 8 / 0.15);
    color: rgb(250 204 21); /* yellow-400 */
}
.log-badge-preference {
    background-color: rgb(6 182 212 / 0.15);
    color: rgb(34 211 238); /* cyan-400 */
}

/* Category filter pills */
.cat-pill {
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    color: rgb(148 163 184);
    background: none;
}
.cat-pill:hover {
    background: rgb(255 255 255 / 0.05);
}
.cat-pill.active {
    border-color: rgb(59 130 246);
    color: rgb(96 165 250);
    background: rgb(59 130 246 / 0.1);
}

/* Copy button — visible on parent hover */
.copy-btn {
    opacity: 0;
    transition: opacity 0.15s;
}
.group:hover .copy-btn,
*:hover > .copy-btn {
    opacity: 1;
}

/* Search highlight */
mark {
    background: rgb(234 179 8 / 0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Toast warning */
.toast-warning {
    background-color: rgb(113 63 18);
    color: rgb(250 204 21);
    border: 1px solid rgb(234 179 8 / 0.3);
}

/* ---- Mobile Sidebar ---- */
#sidebar.sidebar-open {
    transform: translateX(0);
}

#sidebar-overlay {
    opacity: 0;
    transition: opacity 300ms ease-in-out;
    pointer-events: none;
}
#sidebar-overlay.overlay-visible {
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-is-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .nav-link {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        min-height: 44px;
    }
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        text-align: center;
    }
}

/* ---- Services Page ---- */

/* Compact service card */
.svc-compact-card {
    padding: 0.75rem 1rem;
}

/* Log viewer normal height */
.svc-log-viewer-normal {
    height: 300px;
    min-height: 200px;
}

/* Log panel expanded mode — fill viewport */
.svc-log-expanded {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
}
.svc-log-expanded .svc-log-viewer-normal {
    flex: 1;
    height: auto;
    max-height: none;
    min-height: 200px;
}
@media (max-width: 767px) {
    .svc-log-expanded {
        height: calc(100vh - 5rem);
    }
}

/* Icon-only action buttons */
.svc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}
.svc-icon-btn-success {
    background: rgb(20 83 45 / 0.5);
    color: rgb(74 222 128);
}
.svc-icon-btn-success:hover {
    background: rgb(20 83 45 / 0.8);
}
.svc-icon-btn-danger {
    background: rgb(127 29 29 / 0.4);
    color: rgb(248 113 113);
}
.svc-icon-btn-danger:hover {
    background: rgb(153 27 27 / 0.6);
}
.svc-icon-btn-warning {
    background: rgb(113 63 18 / 0.4);
    color: rgb(250 204 21);
}
.svc-icon-btn-warning:hover {
    background: rgb(113 63 18 / 0.7);
}
.svc-icon-btn-secondary {
    background: rgb(51 65 85 / 0.5);
    color: rgb(148 163 184);
}
.svc-icon-btn-secondary:hover {
    background: rgb(71 85 105 / 0.8);
}

/* Log tab bar */
.svc-log-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(148 163 184);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    white-space: nowrap;
}
.svc-log-tab:hover {
    color: rgb(226 232 240);
}
.svc-log-tab.active {
    color: rgb(59 130 246);
    border-bottom-color: rgb(59 130 246);
}

/* Tab connection dot */
.svc-tab-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    display: inline-block;
    flex-shrink: 0;
}

/* iOS safe area */
@supports (padding: env(safe-area-inset-top)) {
    #mobile-header {
        padding-top: env(safe-area-inset-top);
        height: calc(3rem + env(safe-area-inset-top));
    }
    @media (max-width: 767px) {
        main {
            padding-top: calc(3rem + env(safe-area-inset-top));
        }
    }
}
