/* CRM Service - Admin Styles */

:root {
    --sidebar-bg: #1e1e2e;
    --sidebar-text: #cdd6f4;
    --sidebar-hover: #313244;
    --content-bg: #f5f5f5;
    --card-bg: #ffffff;
    --primary: #4a7dff;
    --primary-hover: #3a6ae8;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #27ae60;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --badge-bg: #e8eaf6;
    --badge-text: #3949ab;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--content-bg);
}

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

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 0;
    flex-shrink: 0;
}

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

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.nav-links {
    list-style: none;
    padding: 12px 0;
}

.nav-links li a {
    display: block;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.nav-links li a:hover {
    background: var(--sidebar-hover);
}

/* Content */
.content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

h1 {
    font-size: 28px;
    margin-bottom: 24px;
    font-weight: 600;
}

h3 {
    font-size: 18px;
    margin-bottom: 16px;
    font-weight: 600;
}

.subtitle {
    color: var(--text-light);
    margin-top: -16px;
    margin-bottom: 24px;
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Panels */
.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.panel {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-light);
}

.data-table th a {
    color: var(--text-light);
    text-decoration: none;
}

.data-table th a:hover {
    color: var(--primary);
}

.data-table td {
    font-size: 14px;
}

.data-table td a {
    color: var(--primary);
    text-decoration: none;
}

.data-table td a:hover {
    text-decoration: underline;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 14px;
}

.detail-table th {
    width: 140px;
    color: var(--text-light);
    font-weight: 500;
}

/* Badges */
.tag-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--badge-bg);
    color: var(--badge-text);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
}

.tag-removable {
    position: relative;
    padding-right: 24px;
}

.tag-remove {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--badge-text);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

.tag-remove:hover {
    color: var(--danger);
}

.score-badge {
    display: inline-block;
    padding: 3px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.score-large {
    font-size: 18px;
    padding: 6px 16px;
}

.activity-badge {
    display: inline-block;
    padding: 3px 10px;
    background: #fff3e0;
    color: #e65100;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.source-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #f3e5f5;
    color: #7b1fa2;
    border-radius: 4px;
    font-size: 11px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

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

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

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

.btn-secondary:hover {
    background: #d0d0d0;
}

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

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

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Forms */
.input-field {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(74, 125, 255, 0.2);
}

.input-small {
    width: 200px;
}

.textarea-field {
    width: 100%;
    resize: vertical;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-light);
}

.form-group .input-field {
    width: 100%;
    max-width: 400px;
}

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

/* Search bar */
.search-bar {
    margin-bottom: 24px;
}

/* Notes */
.note-form {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.note-card {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.note-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.note-date {
    color: var(--text-light);
    font-size: 12px;
}

/* Timeline */
.timeline {
    border-left: 3px solid var(--border);
    padding-left: 24px;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 6px;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.timeline-date {
    color: var(--text-light);
    font-size: 12px;
}

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.detail-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

/* Tags container */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Simple list */
.simple-list {
    list-style: none;
}

.simple-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.count {
    color: var(--text-light);
    font-size: 13px;
}

/* Empty state */
.empty-state {
    color: var(--text-light);
    font-style: italic;
    padding: 16px 0;
}

/* Actions bar */
.actions-bar {
    margin-top: 24px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: centre;
    padding: 16px 0;
    font-size: 14px;
    color: var(--text-light);
}

/* Flash messages */
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.flash-error {
    background: #fce4ec;
    color: #c62828;
}

.flash-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* Responsive */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .nav-links {
        display: flex;
        padding: 0;
    }

    .nav-links li a {
        padding: 12px 16px;
    }

    .dashboard-panels,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 16px;
    }
}
