/**
 * Dashboard Styles - Marionette-like theme
 */

/* Font */
body {
    font-family: 'Noto Sans JP', sans-serif;
}

/* Sidebar */
.sidebar-header {
    display: flex;
    align-items: center;
}

/* Menu Items - Marionette style */
.menu-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem;
    font-weight: 500;
    color: hsl(var(--bc));
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
}

.menu-item svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    min-width: 1.25rem;
    flex-shrink: 0;
}

.menu-item.active {
    background-color: hsl(var(--p));
    color: hsl(var(--pc));
    box-shadow: 0 10px 15px -3px rgb(15 23 42 / 0.1);
}

.menu-item.active svg {
    color: hsl(var(--pc));
}

.menu-item:not(.active):hover {
    background-color: hsl(var(--b2));
}

/* Page Content */
.page-content {
    display: none !important;
}

.page-content.active {
    display: flex !important;
}

/* Stats */
.stat {
    border: 1px solid hsl(var(--b3));
}

.stat-title {
    color: hsl(var(--bc) / 0.6);
}

/* Table */
.table th {
    background-color: hsl(var(--b2));
    font-weight: 600;
    font-size: 0.75rem;
}

.table td {
    font-size: 0.8125rem;
}

/* Service Badge */
.service-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: hsl(var(--b2));
    border: 1px solid hsl(var(--b3));
}

.service-badge.youtube { border-color: #ff0000; color: #cc0000; }
.service-badge.soundcloud { border-color: #ff5500; color: #ff5500; }
.service-badge.niconico { border-color: #252525; color: #252525; }
.service-badge.radiko { border-color: #00a4de; color: #00a4de; }
.service-badge.twitch { border-color: #9146ff; color: #9146ff; }
.service-badge.ted { border-color: #e62b1e; color: #e62b1e; }
.service-badge.podcast { border-color: #8e44ad; color: #8e44ad; }

/* Service Card */
.service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    background: hsl(var(--b1));
    border: 1px solid hsl(var(--b3));
    border-radius: 0.5rem;
    cursor: default;
    transition: all 0.15s ease;
}

.service-card:hover {
    border-color: hsl(var(--p));
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.service-card-icon {
    font-size: 1.25rem;
}

.service-card-name {
    font-size: 0.6875rem;
    color: hsl(var(--bc) / 0.7);
    font-weight: 500;
}

/* Queue Item */
.queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: hsl(var(--b1));
    border: 1px solid hsl(var(--b3));
    border-radius: 0.5rem;
}

.queue-item:hover {
    border-color: hsl(var(--p) / 0.5);
}

.queue-item-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--b2));
    border-radius: 0.375rem;
    font-size: 1rem;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
}

.queue-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
}

.queue-item-url {
    font-size: 0.6875rem;
    color: hsl(var(--bc) / 0.5);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress */
.progress-bar {
    height: 4px;
    background: hsl(var(--b3));
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.375rem;
}

.progress-bar-fill {
    height: 100%;
    background: hsl(var(--p));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Status badges */
.status-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.6875rem;
    font-weight: 500;
}

.status-pending {
    background: hsl(var(--wa) / 0.15);
    color: hsl(var(--wa));
}

.status-downloading {
    background: hsl(var(--in) / 0.15);
    color: hsl(var(--in));
}

.status-completed {
    background: hsl(var(--su) / 0.15);
    color: hsl(var(--su));
}

.status-failed {
    background: hsl(var(--er) / 0.15);
    color: hsl(var(--er));
}

.status-skipped {
    background: hsl(var(--bc) / 0.1);
    color: hsl(var(--bc) / 0.6);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease;
}

/* Refresh spinner */
.refresh-spin {
    animation: spin 0.8s linear infinite;
}

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

/* Card styling */
.card {
    border: 1px solid hsl(var(--b3));
}

/* Header styling */
/* Pane dividers (sidebar/content split, header separators) */
:root {
    /* use foreground color with low alpha so it never becomes "black line" */
    --pane-divider: hsl(var(--bc) / 0.12);
}

[data-theme="dark"] {
    --pane-divider: hsl(var(--bc) / 0.22);
}

header {
    border-bottom-color: var(--pane-divider) !important;
}

#sidebar {
    border-right-color: var(--pane-divider) !important;
}

/* Tunnel accordion */
.tunnel-item {
    transition: box-shadow 0.2s ease;
}

.tunnel-item:hover {
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
}

.tunnel-header:hover {
    background-color: hsl(var(--b3) / 0.3);
}

.tunnel-arrow {
    flex-shrink: 0;
    opacity: 0.5;
}

.tunnel-header:hover .tunnel-arrow {
    opacity: 1;
}

.tunnel-content {
    border-top: 1px solid hsl(var(--b3));
}

/* Browser Session */
#browser-screenshot-container:focus {
    outline: 2px solid hsl(var(--p));
    outline-offset: -2px;
}

.browser-click-indicator {
    position: absolute;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid hsl(var(--p));
    border-radius: 50%;
    animation: click-ripple 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes click-ripple {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}
