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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f1117;
    color: #e0e0e0;
    min-height: 100vh;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: #161822;
    border: 1px solid #2a2d3a;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #8b8fa3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    padding: 10px 14px;
    background: #1e2030;
    border: 1px solid #2a2d3a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: #4a6cf7;
}

.form-group input::placeholder {
    color: #555770;
}

.login-btn {
    padding: 12px;
    background: #4a6cf7;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}

.login-btn:hover {
    background: #3b5de7;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #161822;
    border-right: 1px solid #2a2d3a;
    padding: 20px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
    border-bottom: 1px solid #2a2d3a;
    margin-bottom: 8px;
}

.sidebar-header h2 {
    padding: 0;
    border-bottom: none;
    margin-bottom: 0;
}

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

.logs-link {
    font-size: 11px;
    color: #8b8fa3;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.logs-link:hover {
    color: #7b9ef7;
    background: #1b2040;
}

.logout-btn {
    font-size: 11px;
    color: #6b6f82;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.logout-btn:hover {
    color: #f08080;
    background: #2d1b1b;
}

.sidebar h2 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8b8fa3;
    padding: 0 16px 12px;
    border-bottom: 1px solid #2a2d3a;
    margin-bottom: 8px;
}

.history-list {
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px;
    text-decoration: none;
    color: #c4c7d4;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.history-item:hover {
    background: #1e2030;
    border-left-color: #4a6cf7;
}

.history-item.active {
    background: #1e2030;
    border-left-color: #4a6cf7;
}

.history-query {
    font-size: 14px;
    font-weight: 500;
    word-break: break-all;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b6f82;
}

.history-count {
    font-size: 11px;
}

.history-row {
    display: flex;
    align-items: stretch;
    position: relative;
}

.history-row .history-item {
    flex: 1;
    min-width: 0;
}

.history-row:hover .delete-btn {
    opacity: 1;
}

.delete-form {
    display: flex;
    align-items: center;
}

.delete-btn {
    background: none;
    border: none;
    color: #555770;
    font-size: 18px;
    cursor: pointer;
    padding: 0 10px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
}

.delete-btn:hover {
    color: #f08080;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #2a2d3a;
    margin-top: 8px;
}

.clear-all-btn {
    width: 100%;
    padding: 8px 12px;
    background: #2d1b1b;
    border: 1px solid #5c2020;
    border-radius: 6px;
    color: #f08080;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.clear-all-btn:hover {
    background: #3d2020;
}

.empty-state {
    color: #6b6f82;
    font-size: 13px;
    padding: 16px;
    text-align: center;
}

/* Main */
.main {
    flex: 1;
    padding: 40px;
    max-width: 1200px;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.subtitle {
    color: #6b6f82;
    font-size: 14px;
    margin-bottom: 28px;
}

/* Search */
.search-form {
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    background: #1e2030;
    border: 1px solid #2a2d3a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}

.search-input:focus {
    border-color: #4a6cf7;
}

.search-input::placeholder {
    color: #555770;
}

.search-select {
    padding: 10px 12px;
    background: #1e2030;
    border: 1px solid #2a2d3a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.search-select:focus {
    border-color: #4a6cf7;
}

.search-btn {
    padding: 10px 24px;
    background: #4a6cf7;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.search-btn:hover {
    background: #3b5de7;
}

/* Alerts */
.alert {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #2d1b1b;
    border: 1px solid #5c2020;
    color: #f08080;
}

/* Cache status */
.cache-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cache-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cache-cached {
    background: #1b2d1b;
    color: #80f080;
    border: 1px solid #205c20;
}

.cache-live {
    background: #2d2a1b;
    color: #f0d080;
    border: 1px solid #5c4e20;
}

.result-total {
    font-size: 13px;
    color: #8b8fa3;
    margin-left: auto;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-email {
    background: #1b2040;
    color: #7b9ef7;
}

.badge-domain {
    background: #1b3040;
    color: #7bcaf7;
}

.badge-leakcheck {
    background: #1b2d20;
    color: #80c090;
}

.badge-dehashed {
    background: #2d1b2d;
    color: #c080c0;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid #2a2d3a;
    border-radius: 8px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.results-table th {
    background: #1a1c2a;
    color: #8b8fa3;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #2a2d3a;
    position: sticky;
    top: 0;
}

.results-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #1e2030;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.results-table tr:hover td {
    background: #1a1c2a;
}

.mono {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    color: #a0a4b8;
}

.truncate {
    max-width: 120px;
}

/* Comparison panel */
.comparison-panel {
    background: #161822;
    border: 1px solid #2a2d3a;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.comparison-panel h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8b8fa3;
    margin-bottom: 16px;
}

.comparison-panel h4 {
    font-size: 13px;
    color: #c4c7d4;
    margin: 16px 0 8px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.comp-card {
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.comp-leakcheck {
    background: #0f1f14;
    border: 1px solid #1b3d22;
}

.comp-overlap {
    background: #1a1a0f;
    border: 1px solid #3d3d1b;
}

.comp-dehashed {
    background: #1f0f1f;
    border: 1px solid #3d1b3d;
}

.comp-number {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 4px;
}

.comp-leakcheck .comp-number { color: #80c090; }
.comp-overlap .comp-number { color: #e0d080; }
.comp-dehashed .comp-number { color: #c080c0; }

.comp-label {
    font-size: 13px;
    color: #c4c7d4;
    font-weight: 500;
}

.comp-detail {
    font-size: 11px;
    color: #6b6f82;
    margin-top: 4px;
}

.comp-details-toggle {
    margin-top: 12px;
    text-align: center;
}

.toggle-btn {
    background: #1e2030;
    border: 1px solid #2a2d3a;
    border-radius: 6px;
    color: #8b8fa3;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.toggle-btn:hover {
    background: #2a2d3a;
    color: #e0e0e0;
}

.hidden {
    display: none;
}

/* Empty results */
.empty-results {
    text-align: center;
    padding: 60px 20px;
    color: #6b6f82;
}

.empty-results strong {
    color: #e0e0e0;
}

/* Logs page */
.logs-page {
    padding: 40px;
    max-width: 1100px;
    margin: 0 auto;
}

.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.logs-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.logs-subtitle {
    font-size: 13px;
    color: #6b6f82;
    margin-top: 2px;
}

.logs-actions {
    display: flex;
    gap: 8px;
}

.export-btn {
    padding: 8px 16px;
    background: #1b2d20;
    border: 1px solid #2a5a30;
    border-radius: 6px;
    color: #80c090;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.export-btn:hover {
    background: #244028;
}

.back-btn {
    padding: 8px 16px;
    background: #1e2030;
    border: 1px solid #2a2d3a;
    border-radius: 6px;
    color: #8b8fa3;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}

.back-btn:hover {
    background: #2a2d3a;
    color: #e0e0e0;
}

.badge-user {
    background: #1b2040;
    color: #7b9ef7;
}

.log-query {
    font-weight: 500;
    color: #e0e0e0;
}

.logs-table td {
    max-width: 300px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-card {
    background: #161822;
    border: 1px solid #2a2d3a;
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    min-width: 320px;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #2a2d3a;
    border-top-color: #4a6cf7;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.loading-detail {
    font-size: 13px;
    color: #8b8fa3;
    margin-bottom: 16px;
    transition: opacity 0.3s;
}

.loading-timer {
    font-size: 24px;
    font-weight: 700;
    color: #4a6cf7;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}
