:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #a855f7;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    gap: 2rem;
}

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

.header-actions-main {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.settings-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-section {
    padding: 1.5rem 0;
}

.settings-section h4 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.settings-help {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.settings-divider {
    height: 1px;
    background: var(--glass-border);
    width: 100%;
}

/* Floating Action Button */
.fab-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
}

.btn-fab {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.auto-refresh-box {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

#refresh-countdown {
    color: var(--primary);
    font-weight: bold;
    font-family: monospace;
}

/* Live Console Styles */
.live-console {
    position: fixed;
    bottom: 5rem;
    left: 2rem;
    right: 2rem;
    height: 120px;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 90;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.console-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #e0e0e0;
}

.console-line {
    margin-bottom: 0.25rem;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}

.console-line.system { border-left-color: var(--primary); color: var(--primary); }
.console-line.info { border-left-color: #64b5f6; }
.console-line.success { border-left-color: var(--success); color: var(--success); }
.console-line.warning { border-left-color: var(--warning); color: var(--warning); }
.console-line.error { border-left-color: var(--error); color: var(--error); }

/* New Status Styles */
.status-queued {
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

.status-scanning {
    background: rgba(33, 150, 243, 0.2);
    color: #2196f3;
    animation: pulse 1.5s infinite;
}

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

.btn-fab:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.btn-fab i {
    font-size: 1.2rem;
}

/* Checkboxes */
/* Checkboxes */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.recrawl-hint {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--warning);
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.8;
}

.recrawl-hint:hover {
    opacity: 1;
}

#sites-table th:first-child,
#sites-table td:first-child {
    text-align: center;
    padding-left: 1rem;
    padding-right: 1rem;
}



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

.logo i {
    font-size: 2rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-summary {
    display: flex;
    gap: 2rem;
}

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

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.add-site-section {
    margin-bottom: 3rem;
}

.add-site-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.input-group {
    display: flex;
    gap: 1rem;
}

input[type="url"] {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="url"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Sites Grid */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.site-card {
    position: relative;
    transition: transform 0.3s ease;
}

/* Sites Table */
.table-container {
    padding: 1.5rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


.search-box {
    position: relative;
    flex: 0 1 300px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    color: white;
    font-family: inherit;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

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

.site-name-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-name-cell .site-url {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.actions-header {
    text-align: right;
}

.site-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-active { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.status-error { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.status-pending { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.status-changed { background: rgba(99, 102, 241, 0.2); color: #818cf8; }


.site-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.site-actions {
    display: flex;
    gap: 1rem;
}

.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Loader */
.loader-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--glass-border);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn-delete-small {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete-small:hover {
    background: var(--error);
    color: white;
}

.loading-td {
    text-align: center;
    padding: 4rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    margin: 5% auto;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 3rem;
}

.sub-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0,0,0,0.1);
    border-radius: 0.5rem;
}

.sub-table th {
    background: rgba(255,255,255,0.02);
    padding: 0.75rem;
}

.sub-table td {
    padding: 0.75rem;
    font-size: 0.85rem;
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: white;
}

/* History List */
.history-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--glass-border);
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

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

.history-type {
    font-weight: 700;
    font-size: 0.75rem;
}

.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

.history-desc {
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-mini {
    margin-top: 1rem;
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
}

/* Diff Viewer */
.diff-container {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    height: 500px;
}

.diff-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
}

.diff-box h4 {
    padding: 0.75rem;
    background: rgba(255,255,255,0.05);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.diff-content {
    flex: 1;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-y: auto;
    line-height: 1.6;
}

.diff-content.old { color: #fca5a5; }
.diff-content.new { color: #86efac; }

/* Advanced Diff Viewer */
.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.diff-toggles {
    display: flex;
    gap: 0.5rem;
    background: rgba(255,255,255,0.05);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.btn-mini.active {
    background: var(--primary);
    color: white;
}

.unified-diff {
    background: rgba(0,0,0,0.2);
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
    padding: 1rem;
    overflow-y: auto;
    max-height: 60vh;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line {
    padding: 0 0.5rem;
    border-radius: 0.25rem;
}

.diff-line.added {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.diff-line.removed {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.diff-line.context {
    color: var(--text-muted);
    opacity: 0.8;
}

.context-summary {
    text-align: center;
    padding: 0.5rem;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.02);
    margin: 0.5rem 0;
}

