* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1400px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 28px;
}

.manager-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.manager-section label {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    font-size: 14px;
}

.manager-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.manager-input:focus {
    outline: none;
    border-color: #667eea;
}

.input-section {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

small {
    display: block;
    margin-top: 8px;
    color: #888;
    font-size: 12px;
}

code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #667eea;
}

button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.status {
    margin-top: 30px;
    padding: 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.details {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.details h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.details p {
    margin: 8px 0;
    color: #555;
    font-size: 14px;
}

.details strong {
    color: #333;
}

.details pre {
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    margin-top: 10px;
}

.hidden {
    display: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.controls {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.controls button {
    width: auto;
    padding: 12px 24px;
}

.leads-container {
    margin-top: 30px;
}

.leads-header {
    margin-bottom: 20px;
}

.leads-header h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 8px;
}

.lead-count {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.embed-controls {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.embed-control-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    user-select: none;
}

.embed-control-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Cards Container */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    padding: 20px 0;
}

/* Lead Card */
.lead-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.card-checkbox-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.card-select-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.lead-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.tiktok-embed-card {
    width: 100%;
    min-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.tiktok-embed-card .tiktok-embed {
    width: 100%;
    max-width: 100%;
}

/* Prevent autoplay on TikTok embed videos */
.tiktok-embed-card .tiktok-embed iframe,
.tiktok-embed-card .tiktok-embed video {
    pointer-events: auto;
}

.tiktok-embed-card .tiktok-embed[data-autoplay="false"] iframe,
.tiktok-embed-card .tiktok-embed[data-autoplay="false"] video {
    autoplay: false;
}

/* Embed placeholder styling - matches TikTok embed size */
.embed-placeholder {
    width: 100%;
    max-width: 780px;
    min-width: 288px;
    min-height: 300px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px dashed #667eea;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto;
}

.embed-placeholder:hover {
    background: linear-gradient(135deg, #e8ecf1 0%, #b8c5d8 100%);
    border-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.embed-placeholder-content {
    text-align: center;
    padding: 20px;
}

.embed-placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.embed-placeholder-text {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
}

.embed-placeholder-hint {
    font-size: 14px;
    color: #888;
    font-style: italic;
}

.card-user-info {
    width: 100%;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.card-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e0e0e0;
}

.card-info-row:last-child {
    border-bottom: none;
}

.card-info-label {
    font-weight: 600;
    color: #666;
    font-size: 13px;
}

.card-info-value {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.embed-toggle-btn {
    width: 100%;
    padding: 10px 20px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
    margin-bottom: 8px;
}

.embed-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.embed-toggle-btn:active {
    transform: translateY(0);
}

.view-more-btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: auto;
}

.view-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.view-more-btn:active {
    transform: translateY(0);
}

/* Tag Filter Section */
.filter-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Bulk Actions Section */
.bulk-actions-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    user-select: none;
}

.select-all-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.bulk-close-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.bulk-close-btn:hover:not(:disabled) {
    background: #c82333;
}

.bulk-close-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.tag-filter-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    min-width: 200px;
    transition: border-color 0.2s;
}

.tag-filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Card Tag Section */
.card-tag-section {
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-tag-label {
    font-weight: 600;
    color: #666;
    font-size: 13px;
    white-space: nowrap;
}

.card-tag-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.card-tag-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px 0;
}

.pagination-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.page-info {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Lead Detail Modal */
.detail-modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    color: #667eea;
    font-size: 18px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.detail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #666;
    font-size: 13px;
}

.detail-value {
    color: #333;
    font-size: 14px;
}

.detail-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.detail-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.detail-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 12px;
}

.detail-action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.detail-action-btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
}

.leads-table thead {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 10;
}

.leads-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.leads-table th:last-child {
    border-right: none;
}

.leads-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s;
}

.leads-table tbody tr:hover {
    background-color: #f8f9fa;
}

.leads-table tbody tr:last-child {
    border-bottom: none;
}

.leads-table td {
    padding: 10px 8px;
    color: #555;
    border-right: 1px solid #f0f0f0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leads-table td:last-child {
    border-right: none;
}

.editable-cell {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background-color: #fff;
    transition: border-color 0.2s, background-color 0.2s;
    box-sizing: border-box;
}

.editable-cell:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.editable-cell:hover {
    border-color: #bbb;
}

.hidden-column {
    display: none;
}

.toggle-column-header,
.toggle-column-cell {
    padding: 8px !important;
    text-align: center;
    width: 60px;
}

.toggle-columns-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.toggle-columns-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.toggle-columns-btn:active {
    transform: translateY(0);
}

.clickable-cell {
    transition: color 0.2s;
}

.clickable-cell:hover {
    color: #5568d3 !important;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #000;
}

#tiktokEmbedContainer {
    margin-top: 20px;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    padding: 4px 0;
}

.context-menu.hidden {
    display: none;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.context-menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

/* Tabs Styles */
.tabs-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    margin-bottom: 15px;
    padding: 0;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    color: #666;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    margin-bottom: -1px;
    position: relative;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    color: #667eea;
    background: transparent;
    border-bottom: 2px solid #667eea;
    font-weight: 600;
}

.tab-btn.active:hover {
    color: #5568d3;
    border-bottom-color: #5568d3;
}

