:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --secondary: #64748b;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.7);
    --sidebar-width: 320px;
    --radius: 12px;
}

.dark-theme {
    --bg-app: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --glass: rgba(30, 41, 59, 0.7);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease;
    min-height: 100vh;
}

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.logo .badge {
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-content {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .app-content {
        grid-template-columns: 1fr;
    }
}

/* UI Elements */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    height: fit-content;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-main);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-app);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
}

.icon-btn:hover {
    background: var(--bg-app);
}

.sun-icon { display: none; }
.dark-theme .sun-icon { display: block; }
.dark-theme .moon-icon { display: none; }

/* Input Styles */
.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

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

textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    margin-bottom: 1rem;
    line-height: 1.6;
}

textarea:focus {
    border-color: var(--primary);
}

/* Sidebar Specifics */
.sidebar-section {
    margin-top: 2rem;
}

.sidebar-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.saved-list {
    list-style: none;
}

.saved-list li {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.saved-list li:hover {
    background: var(--bg-app);
}

.saved-list li.active {
    background: var(--primary);
    color: white;
}

.client-item-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.saved-list li:hover .client-item-actions {
    opacity: 1;
}

.delete-client {
    color: var(--danger);
    cursor: pointer;
}

/* Results Content */
.results-section {
    margin-top: 2rem;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card[data-type="unique"] .value { color: var(--success); }
.stat-card[data-type="duplicate"] .value { color: var(--danger); }

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-link {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-link:hover {
    color: var(--text-main);
}

.tab-link.active {
    color: var(--primary);
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

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

.list-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-app);
}

.result-list {
    list-style: none;
}

.result-list li {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-family: monospace;
    font-size: 0.9rem;
}

.result-list li:last-child {
    border-bottom: none;
}

.result-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.result-list li:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Full URL shown in monospace */
.entry-url {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-main);
    word-break: break-all;
    flex: 1;
}

/* Small domain tag beside the URL */
.entry-domain-tag {
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.hidden {
    display: none !important;
}

.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.action-bar {
    display: flex;
    gap: 12px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4);
    border-left: 4px solid var(--primary);
    z-index: 1000;
    animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Helper Text */
.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}
