:root {
    --primary: #3b82f6;
    --surface: #111827;
    --background: #030712;
    --text: #f9fafb;
    --success: #10b981;
    --error: #ef4444;
    --table-bg: #1a1d26;
    --table-alt-bg: #141620;
    --table-header-bg: #0f1118;
    --table-border: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background effects */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
}

.bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.15), rgba(0, 0, 0, 0) 50%);
    filter: blur(100px);
    opacity: 0.3;
}

/* Content wrapper */
.content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Header styles */
.header {
    padding: 1rem 2rem;
    backdrop-filter: blur(8px);
    background-color: rgba(17, 24, 39, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

/* Button styles */
.button-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.button {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.button:hover {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.add-button {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

.save-button {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.send-button {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--primary);
}

.cancel-button {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* Main content styles */
.main-content {
    flex: 1;
    overflow: hidden;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
}

.table-container {
    flex: 1;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--table-header-bg); /* Added back with dark color */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Tabulator overrides - fixed dark theme */
.tabulator {
    background-color: var(--table-bg) !important;
    border: none;
    color: var(--text);
    font-size: 0.875rem;
}

.tabulator .tabulator-header {
    background-color: var(--table-header-bg);
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: var(--table-header-bg);
    border-right: 1px solid var(--table-border);
}

.tabulator .tabulator-header .tabulator-col-content {
    padding: 0.75rem 1rem;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.875rem;
}

.tabulator .tabulator-header .tabulator-col:hover {
    background-color: var(--table-header-bg) !important; /* Override Tabulator's hover state */
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    border-bottom-color: #6b7280;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover .tabulator-col-title {
    color: white;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Fixed tableHolder background */
.tabulator .tabulator-tableHolder {
    background-color: var(--table-bg) !important;
}

/* Fixed row backgrounds */
.tabulator .tabulator-row {
    background-color: var(--table-bg) !important;
    border-bottom: 1px solid var(--table-border);
    color: #e2e8f0;
    transition: background-color 0.2s ease;
}

.tabulator .tabulator-row:hover {
    background-color: rgba(30, 41, 59, 0.8) !important;
}

.tabulator .tabulator-row.tabulator-row-even {
    background-color: var(--table-alt-bg) !important;
}

.tabulator .tabulator-row.tabulator-selected {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #fff;
}

.tabulator .tabulator-row .tabulator-cell {
    padding: 0.5rem 1rem;
    border-right: 1px solid var(--table-border);
    background-color: transparent !important;
    color: #e2e8f0;
    min-width: 50px; /* Increased minimum width */
}

.tabulator .tabulator-col {
    min-width: 50px;
}

.tabulator-col-content {
    width: 100%;
    box-sizing: border-box;
}

.tabulator .tabulator-row .tabulator-cell.tabulator-editing {
    border: 2px solid var(--primary);
    padding: 0.4rem 0.9rem;
    background-color: rgba(30, 41, 59, 0.9) !important;
    color: #e2e8f0;
}

/* Simplified form element styling */
.tabulator input, .tabulator select, .tabulator textarea {
    background-color: rgba(17, 24, 39, 0.95);
    color: #e2e8f0;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    padding: 6px 10px;
    width: calc(100% - 20px);
    margin: 0;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(3, 7, 18, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

.loading-text {
    margin-top: 1rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: fadeInUp 0.3s ease-out, fadeOut 0.3s ease-in 2s forwards;
}

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

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

/* Simplified animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Collaboration specific styles */
.collaborators-container {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
}

.collaborators-header {
    font-size: 0.875rem;
    margin-right: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
}

.collaborators-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.collaborator-badge {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collaborator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* Cell being edited by another user */
.cell-being-edited {
    position: relative;
    box-shadow: 0 0 0 2px inset;
}

.editor-name {
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 2px 2px 0 0;
    white-space: nowrap;
    z-index: 100;
    color: #fff !important;
}

/* User cursor */
.user-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    box-sizing: border-box;
    transition: all 0.2s ease;
    animation: pulse 2s infinite;
}

/* User cursor for absolute positioning (mouse tracking) */
.user-cursor-absolute {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: left 0.1s ease, top 0.1s ease;
    box-shadow: 0 0 0 2px white;
}

/* Shared cursor name tag styling */
.cursor-name {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 101;
    color: white;
    font-weight: bold;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Highlight cell when edited */
@keyframes highlight-pulse {
    0% { background-color: rgba(59, 130, 246, 0.6); }
    100% { background-color: transparent; }
}

.remote-edited-cell {
    animation: highlight-pulse 1.5s ease-out;
}

/* Pulse animation for cursors */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 5px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Add these new styles for the tooltip */

/* Column rename tooltip */
.tooltip-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    transform: none;
    background-color: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 320px;
    animation: fadeInBottomRight 0.3s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tooltip-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tooltip-icon {
    font-size: 1.5rem;
}

.tooltip-text {
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--text);
}

.dismiss-button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

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


/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #10b981;
    color: white;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeInUp 0.3s ease-out;
    min-width: 280px;
    max-width: 400px;
}

.toast.error {
    background-color: #ef4444;
    border-left: 4px solid #b91c1c;
}

.toast.warning {
    background-color: #f59e0b;
    border-left: 4px solid #d97706;
}

.toast.info {
    background-color: #3b82f6;
    border-left: 4px solid #2563eb;
}

/* Animation for error highlight on cells */
@keyframes error-flash {
    0%, 100% { background-color: rgba(239, 68, 68, 0.2); }
    50% { background-color: rgba(239, 68, 68, 0.4); }
}

/* Style for cells with data type errors */
.cell-dtype-error {
    animation: error-flash 1s ease-in-out;
    border: 1px solid #ef4444 !important;
}

/* Toast animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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