/* Overseer Website — Custom styles (Tailwind handles most via CDN) */

/* ========== Base & Scrollbar ========== */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1c1917;
}

::-webkit-scrollbar-thumb {
    background: #44403c;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #57534e;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 640px) {
    /* Tighter padding on mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Stack cards vertically */
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Smaller text on mobile */
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.25rem !important; }
    
    /* Full-width tables scroll horizontally */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 641px) {
    /* Hide mobile-only elements on desktop */
    .mobile-only {
        display: none !important;
    }
}

/* ========== Touch Targets ========== */
@media (pointer: coarse) {
    /* Larger touch targets on touch devices */
    button, a, .clickable {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ========== Animations ========== */
.feed-entry {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Throne claim pulse */
.throne-pulse {
    animation: thronePulse 2s ease-in-out infinite;
}

@keyframes thronePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ========== Status Indicators ========== */
.status-dot-connected {
    background-color: #22c55e;
    box-shadow: 0 0 4px #22c55e;
}

.status-dot-disconnected {
    background-color: #6b7280;
}

.status-dot-warning {
    background-color: #f59e0b;
    box-shadow: 0 0 4px #f59e0b;
}

/* ========== Loading States ========== */
.skeleton {
    background: linear-gradient(90deg, #292524 25%, #3a3632 50%, #292524 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #44403c;
    border-top-color: #ca8a04;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== HTMX Loading States ========== */
.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

/* ========== Home Page Polish ========== */
.realm-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 10%, rgba(250, 204, 21, 0.2), transparent 45%),
        radial-gradient(circle at 80% 20%, rgba(244, 114, 182, 0.14), transparent 40%),
        linear-gradient(140deg, rgba(28, 25, 23, 0.96), rgba(17, 24, 39, 0.88));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 60px rgba(0, 0, 0, 0.35);
}

.realm-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.02) 8px,
        transparent 8px,
        transparent 16px
    );
    pointer-events: none;
}

.realm-occupancy-card {
    backdrop-filter: blur(2px);
}

.polished-card {
    background: linear-gradient(165deg, rgba(41, 37, 36, 0.95), rgba(24, 24, 27, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 24px rgba(0, 0, 0, 0.22);
}

.pulse-pill {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.75rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(120, 113, 108, 0.55);
    background: rgba(0, 0, 0, 0.2);
}

.pulse-label {
    color: #a8a29e;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pulse-value {
    color: #f5f5f4;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.quick-jump {
    display: block;
    border: 1px solid rgba(120, 113, 108, 0.4);
    border-radius: 0.65rem;
    padding: 0.6rem 0.75rem;
    color: #d6d3d1;
    transition: border-color 120ms ease, transform 120ms ease, color 120ms ease, background-color 120ms ease;
    background: rgba(15, 23, 42, 0.2);
}

.quick-jump:hover {
    border-color: rgba(250, 204, 21, 0.5);
    color: #fde68a;
    transform: translateX(2px);
    background: rgba(250, 204, 21, 0.08);
}

.quick-jump:active {
    transform: translateX(0);
}

.quick-jump:focus-visible,
.feed-filter-btn:focus-visible,
.feed-action-btn:focus-visible,
.feed-search-input:focus-visible,
.directory-input:focus-visible,
.directory-action-btn:focus-visible,
.directory-secondary-btn:focus-visible,
.directory-result-link:focus-visible {
    outline: 2px solid rgba(250, 204, 21, 0.65);
    outline-offset: 2px;
}

.feed-controls {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.feed-filter-btn,
.feed-action-btn {
    border: 1px solid rgba(120, 113, 108, 0.55);
    background: rgba(28, 25, 23, 0.6);
    color: #d6d3d1;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1;
    transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.feed-filter-btn:hover,
.feed-action-btn:hover {
    border-color: rgba(250, 204, 21, 0.55);
    color: #fde68a;
}

.feed-filter-btn[aria-pressed="true"],
.feed-filter-btn[aria-selected="true"] {
    border-color: rgba(250, 204, 21, 0.65);
    background: rgba(250, 204, 21, 0.15);
    color: #fde68a;
}

.feed-filter-btn.is-active {
    border-color: rgba(250, 204, 21, 0.65);
    background: rgba(250, 204, 21, 0.15);
    color: #fde68a;
}

.feed-action-btn.is-active {
    border-color: rgba(245, 158, 11, 0.65);
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
}

.feed-action-btn-muted {
    border-color: rgba(120, 113, 108, 0.35);
    color: #a8a29e;
}

.feed-filter-btn:disabled,
.feed-action-btn:disabled,
.directory-action-btn:disabled,
.directory-secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #a8a29e;
    border-color: rgba(120, 113, 108, 0.35);
    background: rgba(41, 37, 36, 0.45);
}

.feed-search-input {
    flex: 1;
    min-width: 220px;
    border-radius: 999px;
    border: 1px solid rgba(120, 113, 108, 0.55);
    background: rgba(28, 25, 23, 0.5);
    color: #f5f5f4;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    outline: none;
}

.feed-search-input:focus {
    border-color: rgba(250, 204, 21, 0.55);
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.15);
}

.directory-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(120, 113, 108, 0.55);
    background: rgba(28, 25, 23, 0.5);
    color: #f5f5f4;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    outline: none;
}

.directory-input::placeholder {
    color: #78716c;
}

.directory-input:focus {
    border-color: rgba(250, 204, 21, 0.55);
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.15);
}

.directory-action-btn,
.directory-secondary-btn {
    border-radius: 999px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.directory-action-btn {
    border: 1px solid rgba(250, 204, 21, 0.65);
    background: rgba(250, 204, 21, 0.92);
    color: #111827;
}

.directory-action-btn:hover {
    background: #fcd34d;
    transform: translateY(-1px);
}

.directory-secondary-btn {
    border: 1px solid rgba(120, 113, 108, 0.55);
    background: rgba(28, 25, 23, 0.6);
    color: #d6d3d1;
}

.directory-secondary-btn:hover {
    border-color: rgba(250, 204, 21, 0.55);
    color: #fde68a;
}

.directory-result-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    transition: background-color 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.directory-result-link:hover {
    background: rgba(245, 158, 11, 0.06);
    transform: translateX(2px);
}

.directory-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 113, 108, 0.6);
    background: rgba(41, 37, 36, 0.85);
    color: #f5f5f4;
    flex-shrink: 0;
}

.directory-avatar-live {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.35);
}

.directory-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 113, 108, 0.45);
    background: rgba(0, 0, 0, 0.18);
    color: #d6d3d1;
    font-size: 0.75rem;
    font-weight: 700;
}

.directory-rank-badge.is-top {
    border-color: rgba(250, 204, 21, 0.45);
    color: #fde68a;
    background: rgba(250, 204, 21, 0.1);
}

.feed-entry {
    border-radius: 0.7rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(120, 113, 108, 0.22);
    background: rgba(17, 24, 39, 0.2);
    animation: slideIn 0.24s ease-out;
}

#activity-feed {
    scrollbar-gutter: stable;
}

@media (max-width: 640px) {
    .feed-controls {
        width: 100%;
    }

    .feed-filter-btn {
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
        text-align: center;
    }

    .feed-search-input {
        min-width: 0;
        width: 100%;
    }

    .feed-action-btn {
        width: 100%;
        justify-content: center;
    }

    .directory-action-btn,
    .directory-secondary-btn {
        width: 100%;
        justify-content: center;
    }

    .pulse-pill {
        padding: 0.65rem;
    }

    .pulse-value {
        font-size: 1.1rem;
    }

    .directory-result-link:hover,
    .directory-action-btn:hover,
    .quick-jump:hover {
        transform: none;
    }
}

.feed-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.14rem 0.42rem;
    border: 1px solid rgba(250, 204, 21, 0.3);
    color: #fde68a;
    background: rgba(250, 204, 21, 0.12);
}

/* ========== Print Styles ========== */
@media print {
    nav, footer, .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}
