/* ============================================
   Monitor — Design System
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-input: #1a1a26;
    --bg-overlay: rgba(0, 0, 0, 0.75);

    --text-primary: #e8e8ed;
    --text-secondary: #8888a0;
    --text-muted: #55556a;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-subtle: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(99, 102, 241, 0.5);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Subtle animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 600px;
    background: radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-subtle), transparent);
    pointer-events: none;
    z-index: 0;
}

.app {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ Header ============ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__logo {
    display: flex;
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

.header__title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header__link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.header__link:hover {
    color: var(--accent-hover);
}

.header__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-base);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============ Capture Section ============ */
.capture-section {
    margin-bottom: 32px;
}

.capture-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    transition: border-color var(--transition-base);
}

.capture-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.capture-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============ Capture Options ============ */
.capture-options {
    display: flex;
    align-items: center;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.size-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.size-input {
    width: 70px;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.8125rem;
    text-align: center;
    outline: none;
    transition: border-color var(--transition-fast);
}

.size-input:focus {
    border-color: var(--border-focus);
}

.size-input::placeholder {
    color: var(--text-muted);
}

.size-separator {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============ Capture Status ============ */
.capture-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease-out;
}

.capture-status.loading {
    background: var(--accent-subtle);
    color: var(--accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.capture-status.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.capture-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ Search Section ============ */
.search-section {
    margin-bottom: 24px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 14px 80px 14px 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-count {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ============ Results Grid ============ */
.results-section {
    padding-bottom: 60px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 16px;
}

.empty-state p {
    font-size: 0.9375rem;
}

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

.screenshot-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.screenshot-card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--bg-secondary);
    display: block;
}

.screenshot-card__image-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.screenshot-card__image-placeholder.blocked {
    color: var(--warning);
    border-bottom: 1px solid rgba(245, 158, 11, 0.1);
}

.screenshot-card__image-placeholder.error {
    color: var(--error);
    border-bottom: 1px solid rgba(239, 68, 68, 0.1);
}

.screenshot-card__info {
    padding: 14px 16px;
}

.screenshot-card__url {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.screenshot-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.screenshot-card__status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.screenshot-card__status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.screenshot-card__status-dot.success {
    background: var(--success);
}

.screenshot-card__status-dot.error {
    background: var(--error);
}

.screenshot-card__status-dot.blocked {
    background: var(--warning);
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination__btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination__btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.pagination__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination__info {
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 0 12px;
}

/* ============ Modal ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
}

.modal__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    z-index: 1;
}

.modal__close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal img {
    max-width: 100%;
    max-height: 75vh;
    display: block;
}

.modal__info {
    padding: 16px 20px;
}

.modal__url {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: 4px;
}

.modal__date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.email-url-link {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
}

.email-url-link:hover {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}


/* ============ Utilities ============ */
.hidden {
    display: none !important;
}

/* ============ Loading Spinner ============ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .app {
        padding: 0 16px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .input-group {
        flex-direction: column;
    }

    .capture-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .capture-card {
        padding: 20px;
    }
}

/* ============ Tabs Navigation ============ */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    padding-bottom: 8px;
}

.tab-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.tab-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-link.active {
    color: var(--accent-hover);
    background: var(--accent-subtle);
}

/* ============ Screenshot Card Delete ============ */
.screenshot-card {
    position: relative;
}

.screenshot-card__delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 10;
}

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

.screenshot-card__delete:hover {
    background: var(--error);
    color: white;
    border-color: transparent;
    transform: scale(1.05);
}

/* ============ Safe Browsing & Hash Lookup ============ */
.sb-result-box {
    margin-top: 24px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sb-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sb-info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.sb-info-card__label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.sb-info-card__value {
    font-size: 1rem;
    font-weight: 600;
}

.font-mono {
    font-family: monospace;
    font-size: 0.8125rem !important;
    word-break: break-all;
}

#sbSafetyCard.safe {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

#sbSafetyCard.safe .sb-info-card__value {
    color: var(--success);
}

#sbSafetyCard.unsafe {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

#sbSafetyCard.unsafe .sb-info-card__value {
    color: var(--error);
}

.sb-threat-container {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.sb-threat-container h3 {
    font-size: 0.9375rem;
    color: var(--error);
    margin-bottom: 12px;
}

.sb-threat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-threat-item {
    font-size: 0.8125rem;
    font-family: monospace;
    color: var(--error);
}

.sb-hash-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-x: auto;
}

.sb-hash-table-container h3 {
    font-size: 0.9375rem;
    margin-bottom: 12px;
}

.sb-hash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    text-align: left;
}

.sb-hash-table th, .sb-hash-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.sb-hash-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.sb-hash-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============ VirusTotal custom styles ============ */
.vt-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.vt-type-btn {
    padding: 8px 16px !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.875rem !important;
    border: 1px solid var(--border) !important;
    background: var(--bg-input) !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
    transition: all var(--transition-fast) !important;
}

.vt-type-btn:hover {
    border-color: var(--border-focus) !important;
    color: var(--text-primary) !important;
}

.vt-type-btn.active {
    background: var(--accent-subtle) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
}


