/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7f8f9;
    color: #1f2937;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1f2937;
}

.logo svg {
    flex-shrink: 0;
}

.logo-text {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.sidebar.collapsed .toggle-btn svg {
    transform: rotate(-90deg);
}

.sidebar-nav {
    padding: 8px;
    flex: 1;
}

.sidebar-footer {
    padding: 8px;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.nav-item.active {
    background: #eff6ff;
    color: #2563eb;
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Page Header */
.page-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

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

.breadcrumb {
    font-size: 14px;
    color: #6b7280;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Board Layout */
.board {
    display: flex;
    gap: 0;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px;
    background: #f7f8f9;
}

/* Column Styles */
.column {
    background: transparent;
    padding: 0 12px;
    min-width: 320px;
    flex-shrink: 0;
}

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

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.column-header h2 {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    flex: 1;
}

.column-header .count {
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

/* Cards Container */
.cards-container {
    min-height: 200px;
}

/* Opportunity Card Styles */
.opportunity-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: move;
    transition: all 0.2s ease;
    position: relative;
}

.opportunity-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-company {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.card-contact {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.card-value {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
    margin-bottom: 6px;
}

.card-value.high-value {
    color: #dc2626;
}

.card-notes {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}

.card-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.opportunity-card:hover .card-delete {
    opacity: 1;
}

.card-delete:hover {
    background: #dc2626;
}

.add-card-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px dashed #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-card-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

/* Automation Page */
.automation-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.automation-section {
    margin-bottom: 32px;
}

.automation-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.action-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.action-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}

.action-card p {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rule-info {
    flex: 1;
}

.rule-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 8px;
}

.rule-status.active {
    background: #dcfce7;
    color: #166534;
}

.rule-item h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.rule-item p {
    font-size: 12px;
    color: #6b7280;
}

/* Analytics Page */
.analytics-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.2s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-content form {
    padding: 24px;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
    font-size: 13px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #1f2937;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
}

/* Workflow List Styles */
.workflow-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: white;
}

.workflow-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.workflow-filters {
    display: flex;
    gap: 8px;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: #f3f4f6;
    color: #1f2937;
}

.filter-count {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
}

.workflow-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

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

.workflow-table thead th {
    text-align: left;
    padding: 8px 16px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    font-size: 12px;
}

.workflow-table thead th svg {
    vertical-align: middle;
    margin-right: 4px;
}

.workflow-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.workflow-table tbody tr:hover {
    background: #f9fafb;
}

.workflow-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
}

.th-checkbox, .td-checkbox {
    width: 40px;
}

.td-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #1f2937;
}

.text-muted {
    color: #9ca3af;
    font-weight: 400;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.draft {
    background: #f3f4f6;
    color: #6b7280;
}

.creator-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
}

.creator-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.version-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: #eff6ff;
    color: #2563eb;
    margin-right: 4px;
}

.add-new-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.2s ease;
}

.add-new-row:hover {
    background: #f9fafb;
}

/* Workflow Editor Styles */
.workflow-editor-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.workflow-canvas {
    flex: 1;
    background: #fafafa;
    padding: 40px;
    overflow-y: auto;
    position: relative;
}

.workflow-status-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.workflow-steps {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.workflow-step {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.workflow-step:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.workflow-step.selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.workflow-step.trigger .step-icon {
    color: #8b5cf6;
}

.workflow-step.action .step-icon {
    color: #3b82f6;
}

.step-icon {
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.step-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.step-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.workflow-step:hover .step-delete {
    display: flex;
}

.workflow-connector {
    width: 2px;
    height: 32px;
    background: #d1d5db;
    margin: 8px 0;
}

.add-step-btn {
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.add-step-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

/* Filter Drawer */
.filter-drawer {
    width: 400px;
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.drawer-icon {
    flex-shrink: 0;
    color: #6b7280;
}

.drawer-title {
    flex: 1;
}

.drawer-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.drawer-title p {
    font-size: 13px;
    color: #6b7280;
}

.close-drawer {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-drawer:hover {
    background: #f3f4f6;
    color: #1f2937;
}

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

.filter-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.filter-condition {
    margin-bottom: 12px;
}

.filter-condition label {
    display: block;
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    margin-bottom: 6px;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1f2937;
    background: white;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-logic {
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logic-select {
    width: auto;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    color: #6b7280;
    background: white;
}

.remove-rule-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #ef4444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.remove-rule-btn:hover {
    background: #fee2e2;
}

.add-filter-rule {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    margin-top: 16px;
}

.add-filter-rule:hover {
    background: #eff6ff;
}

/* Documentation Page Styles */
.docs-page {
    background: white;
}

.docs-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
}

.docs-container {
    max-width: 900px;
    margin: 0 auto;
}

.docs-section {
    margin-bottom: 48px;
}

.docs-section h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
}

.docs-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    margin-top: 32px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.docs-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    margin-top: 24px;
}

.docs-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.docs-section p {
    font-size: 15px;
    line-height: 1.7;
    color: #4b5563;
    margin-bottom: 16px;
}

.lead {
    font-size: 17px;
    color: #6b7280;
}

.docs-section ul {
    list-style: disc;
    margin-left: 24px;
    margin-bottom: 16px;
}

.docs-section li {
    font-size: 15px;
    line-height: 1.7;
    color: #4b5563;
    margin-bottom: 8px;
}

.docs-section li strong {
    color: #1f2937;
}

/* Table of Contents */
.toc {
    list-style: none;
    margin-left: 0;
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
}

.toc li {
    margin-bottom: 12px;
}

.toc a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s ease;
}

.toc a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Step Guide */
.step-guide {
    margin-top: 24px;
}

.step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
}

.step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    font-size: 16px;
    color: #1f2937;
    margin-bottom: 8px;
}

.step-content p {
    margin-bottom: 8px;
}

.step-content ul {
    margin-top: 8px;
}

/* Tip Boxes */
.tip-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.tip-box h4 {
    color: #1e40af;
    margin-bottom: 8px;
}

.tip-box p {
    color: #1e40af;
    margin-bottom: 0;
}

/* Reference Table */
.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 14px;
}

.reference-table thead {
    background: #f9fafb;
}

.reference-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.reference-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}

.reference-table tbody tr:hover {
    background: #f9fafb;
}

/* Docs Footer */
.docs-footer {
    text-align: center;
    padding-top: 32px;
    border-top: 2px solid #e5e7eb;
}

.docs-footer p {
    margin-bottom: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 64px;
    }

    .sidebar .logo-text,
    .sidebar .nav-item span {
        display: none;
    }

    .board {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .column {
        min-width: 100%;
    }

    .action-cards,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
