/* CSS Reset & Variables */
:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-hover: #252542;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #2d2d4a;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

/* Main App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e1e32 0%, #15152a 100%);
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.logo {
    margin-bottom: 32px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.stats-panel {
    margin-top: auto;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stats-panel h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.stat:last-child {
    border-bottom: none;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-light);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.logout-btn {
    display: block;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: #ef4444;
    text-align: center;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Main Content */
.main {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.header {
    margin-bottom: 24px;
}

.header h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.header p {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.action-btn {
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    border: none;
    color: white;
    font-weight: 600;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

/* Forms */
.form-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.btn.primary:hover {
    background: var(--accent-light);
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Job List */
.job-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.job-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.job-card:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.job-org {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.job-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.job-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.job-status.new {
    background: var(--accent);
    color: white;
}

.job-status.reviewed {
    background: var(--warning);
    color: black;
}

.job-status.contacted {
    background: var(--success);
    color: white;
}

.job-status.responded {
    background: #06b6d4;
    color: white;
}

.job-score {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.job-score strong {
    color: var(--success);
}

/* Profiles */
.profiles-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.profiles-list {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.profiles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.profiles-header h3 {
    font-size: 0.9rem;
}

.profile-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.profile-item:hover {
    background: var(--bg-hover);
}

.profile-item.active {
    background: var(--accent);
    color: white;
}

.profile-editor {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

#profile-editor {
    flex: 1;
    min-height: 400px;
    padding: 16px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
}

.upload-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.upload-section h3 {
    font-size: 0.9rem;
    margin-right: 16px;
}

/* Sources */
.sources-list {
    margin-bottom: 32px;
}

.source-card {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.source-info h4 {
    margin-bottom: 4px;
}

.source-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.source-actions {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border);
}

.modal-content.large {
    max-width: 800px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text);
}

/* Response Output */
.response-output {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: 8px;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

/* Results Panel */
.results-panel {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 24px;
}

/* Loading */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
}

/* Utility */
.recent-section h3 {
    margin-bottom: 16px;
}

.add-source h3 {
    margin-bottom: 16px;
}