/* Screenshot Dashboard Styles */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-card-hover: #222230;
    --text-primary: #f0f0f5;
    --text-secondary: #9090a0;
    --text-muted: #606070;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.15);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-glow);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
}

.refresh-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.refresh-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

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

/* Main Content */
.main-content {
    padding: 2rem;
    min-height: calc(100vh - 100px);
}

/* Screenshot Grid */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .screenshot-grid {
        grid-template-columns: 1fr;
    }
}

/* Screenshot Card */
.screenshot-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.screenshot-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.screenshot-image-wrapper {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-secondary);
}

.screenshot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.screenshot-card:hover .screenshot-image {
    transform: scale(1.02);
}

.screenshot-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.screenshot-card:hover .screenshot-overlay {
    opacity: 1;
}

.screenshot-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.screenshot-info {
    padding: 1.25rem;
}

.agent-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-hostname {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.screenshot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.meta-icon {
    font-size: 0.9rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-success {
    background: var(--success-bg);
    color: var(--success);
}

.status-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-error {
    background: var(--error-bg);
    color: var(--error);
}

.status-pending {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* Error State */
.error-banner {
    background: var(--error-bg);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.error-icon {
    font-size: 1.5rem;
}

.error-message {
    color: var(--error);
    flex: 1;
}

/* Loading */
.loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
}

.loading-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.loading-image {
    aspect-ratio: 16 / 10;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.loading-info {
    padding: 1.25rem;
}

.loading-line {
    height: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.loading-line.short {
    width: 60%;
}

.loading-line.shorter {
    width: 40%;
}

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

/* Auto-refresh indicator */
.auto-refresh {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auto-refresh-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Fullscreen mode */
body.fullscreen-mode .header {
    padding: 1rem 2rem;
}

body.fullscreen-mode .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
}

body.fullscreen-mode .logo-text h1 {
    font-size: 1.25rem;
}

body.fullscreen-mode .main-content {
    padding: 1.5rem;
}

body.fullscreen-mode .screenshot-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-card-hover);
}
