/* Custom properties for theme colors */
:root {
    --bg-dark: #070913;
    --card-bg: rgba(14, 18, 36, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #8a2be2;
    --primary-glow: rgba(138, 43, 226, 0.35);
    --secondary: #00f0ff;
    --secondary-glow: rgba(0, 240, 255, 0.25);
    --accent: #ff007f;
    --text-main: #f5f6fa;
    --text-muted: #8e95b2;
    --console-bg: rgba(3, 5, 12, 0.85);
    --success: #00ff66;
    --error: #ff3366;
    --font-heading: 'Space Grotesk', 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset and base setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
}

/* Dynamic Stars / Glow Background */
.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.03) 1.5px, transparent 1.5px),
        radial-gradient(circle at 40% 50%, rgba(255,255,255,0.02) 2px, transparent 2px);
    background-size: 300px 300px;
    z-index: 0;
    pointer-events: none;
}

.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    top: -150px;
    left: calc(50% - 300px);
    z-index: 0;
    filter: blur(80px);
    pointer-events: none;
    animation: pulseGlow 15s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(50px, 30px); }
}

/* App container */
.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header style */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

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

.logo-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.logo-text h1 span {
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary-glow);
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 2rem;
    align-items: start;
}

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

/* Glassmorphism Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(138, 43, 226, 0.05);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-main);
}

.card-title i {
    color: var(--secondary);
}

/* Scraper inputs form */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.scrape-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label, .option-field label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.url-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.url-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.url-input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.9rem 1rem 0.9rem 2.8rem;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.url-input-wrapper input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
    background: rgba(0, 0, 0, 0.5);
}

.options-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1rem;
    align-items: center;
}

.number-input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: var(--text-main);
    outline: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

.number-input-wrapper input:focus {
    border-color: var(--secondary);
}

/* Checkbox Styling */
.checkbox-field {
    margin-top: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem !important;
}

.checkbox-label input {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: inline-block;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.checkbox-label input:checked + .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.checkbox-label input:checked + .custom-checkbox::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Button glow effects */
.glow-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: #fff;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 4px 20px var(--primary-glow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 25px rgba(0, 240, 255, 0.4);
}

.glow-btn:active {
    transform: translateY(1px);
}

/* Console logs */
.console-card {
    height: 380px;
    display: flex;
    flex-direction: column;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.pulse-idle {
    background-color: var(--text-muted);
}

.pulse-running {
    background-color: var(--success);
    animation: blinkPulse 1s infinite alternate;
}

@keyframes blinkPulse {
    0% { opacity: 0.4; box-shadow: 0 0 0 rgba(0, 255, 102, 0); }
    100% { opacity: 1; box-shadow: 0 0 8px rgba(0, 255, 102, 0.8); }
}

.console-body {
    background: var(--console-bg);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 10px;
    padding: 1rem;
    flex-grow: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    color: #8fa0dd;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.console-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    gap: 0.8rem;
}

.console-placeholder i {
    font-size: 2rem;
    opacity: 0.3;
}

.log-item {
    border-left: 2px solid var(--primary);
    padding-left: 0.6rem;
    animation: slideInLog 0.2s ease-out;
}

.log-item.success {
    border-color: var(--success);
    color: var(--success);
}

.log-item.error {
    border-color: var(--error);
    color: var(--error);
}

@keyframes slideInLog {
    from { transform: translateX(-5px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Results panel tabs */
.results-card {
    min-height: 600px;
    height: calc(100vh - 160px);
}

@media (max-width: 1024px) {
    .results-card {
        height: 650px;
    }
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.2rem;
    gap: 0.5rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.8rem 1.2rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.02);
}

.tab-btn.active {
    color: var(--secondary);
    background: rgba(0, 240, 255, 0.06);
    border-bottom: 2px solid var(--secondary);
}

/* Tab content panes */
.tabs-content {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

.tab-pane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.tab-pane.active {
    display: flex;
}

.pane-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.15);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.02);
}

.stats-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.action-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

/* Viewers details */
.markdown-viewer, .json-viewer, .code-viewer {
    background: rgba(3, 5, 12, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.2rem;
    flex-grow: 1;
    overflow: auto;
}

.markdown-viewer pre, .json-viewer pre, .code-viewer pre {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-all;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 4rem;
}

.screenshot-viewer {
    background: rgba(3, 5, 12, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 1rem;
}

.screenshot-viewer img {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* API Integration Code Tab selectors */
.snippet-selector {
    display: flex;
    gap: 0.3rem;
}

.snippet-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.snippet-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Notification toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(10, 20, 40, 0.95);
    border: 1px solid var(--secondary);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 20px var(--secondary-glow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* User Profile Header */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem 0.4rem 0.4rem;
    border-radius: 50px;
    transition: var(--transition);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--secondary);
    box-shadow: 0 0 8px var(--secondary-glow);
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.logout-btn {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.logout-btn:hover {
    color: var(--error);
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.4);
}

/* History Analytics stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.stat-card {
    background: rgba(3, 5, 12, 0.4);
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(0, 240, 255, 0.15);
    transform: translateY(-2px);
}

.stat-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-title i {
    color: var(--secondary);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* History logging log entries table */
.history-table-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    background: rgba(3, 5, 12, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.history-table th {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    color: #cbd5e1;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: #fff;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.badge-status {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-block;
}

.badge-status.success {
    background: rgba(0, 255, 102, 0.1);
    border: 1px solid rgba(0, 255, 102, 0.2);
    color: var(--success);
}

.badge-status.failed {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.2);
    color: var(--error);
}

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

