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

:root {
    --bg-primary: #0d0e12;
    --bg-secondary: #16171d;
    --bg-tertiary: #1c1d24;
    --bg-elevated: #25272f;
    
    --text-primary: #e6e8f0;
    --text-secondary: #9b9faf;
    --text-tertiary: #6b6f7f;
    
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 255, 255, 0.16);
    
    --accent: #5e6ad2;
    --accent-hover: #4f5ab5;
    --accent-light: rgba(94, 106, 210, 0.1);
    
    --success: #26b56e;
    --success-light: rgba(38, 181, 110, 0.1);
    
    --error: #f2545b;
    --error-light: rgba(242, 84, 91, 0.1);
    
    --sidebar-width: 320px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo svg {
    color: var(--accent);
}

.sidebar-content {
    flex: 1;
    padding: 24px 20px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 12px;
}

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

.search-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'SF Mono', 'Consolas', monospace;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-tertiary);
}

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

.btn-search {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-search:hover {
    background: var(--accent-hover);
}

.btn-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.hint-icon {
    font-size: 14px;
}

.active-searches-info {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
}

.info-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'SF Mono', 'Consolas', monospace;
}

/* Main Content */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
}

.main-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* Searches Grid */
.searches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Search Card */
.search-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: fit-content;
    animation: slideIn 0.3s ease-out;
}

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

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-searching {
    background: var(--accent-light);
    color: var(--accent);
}

.status-success {
    background: var(--success-light);
    color: var(--success);
}

.status-error {
    background: var(--error-light);
    color: var(--error);
}

.btn-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.card-body {
    padding: 16px;
    flex: 1;
}

/* Log Section */
.log-section {
    margin-bottom: 16px;
}

.log-entries {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
}

.log-entry {
    padding: 4px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

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

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

/* Document Info */
.doc-info {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

.info-header svg {
    color: var(--accent);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    font-weight: 700;
}

.info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--success);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: #20a05e;
    transform: translateY(-1px);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    color: var(--text-tertiary);
    text-align: center;
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state span {
    font-size: 14px;
}

/* Scrollbar */
.log-entries::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.log-entries::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.log-entries::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.log-entries::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-focus);
}

/* Responsive */
@media (max-width: 1200px) {
    .searches-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main {
        margin-left: 0;
        padding: 20px;
    }
    
    .searches-grid {
        grid-template-columns: 1fr;
    }
}
