@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@400;600&display=swap');

:root {
    --primary-color: #fd7b3d;
    --primary-hover: #e66a2e;
    --secondary-color: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --bg-color: #f8f9fa;
    --bg-surface: #ffffff;
    --border-color: #dee2e6;
    --text-color: #212529;
    --selection-bg: rgba(253, 123, 61, 0.1);
    --selection-border: rgba(253, 123, 61, 0.4);
    --header-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header & Navbar */
header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ff4500;
    /* color: var(--primary-color); */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Toolbar */
.toolbar {
    background: var(--bg-surface);
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.5rem;
    border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
    border-right: none;
}

button {
    background: var(--bg-surface);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

button:hover {
    background: var(--bg-color);
    border-color: #cbd5e1;
}

button.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

/* Spreadsheet Container */
#sheet-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #e2e8f0;
}

#spreadsheet {
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--bg-surface);
    z-index: 5;
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 0;
    min-width: 100px;
    height: 30px;
    max-height: 30px;
    position: relative;
    overflow: hidden;
}

/* Row & Column Headers */
.row-header,
.col-header {
    background: var(--header-bg);
    color: var(--secondary-color);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    user-select: none;
    position: sticky;
    z-index: 10;
    cursor: pointer;
}

.row-header {
    width: 40px;
    left: 0;
}

.col-header {
    top: 0;
}

.row-header:hover,
.col-header:hover {
    background: #e9ecef;
    color: var(--text-color);
}

.corner-header {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 30;
    background: var(--header-bg);
}

/* Cell Input */
td input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    padding: 0 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
}

/* Selection Styles */
td.cell-selected {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
    z-index: 5;
    position: relative;
}

td.row-selection,
td.col-selection {
    background-color: var(--selection-bg);
}

th.header-selected {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.export-container {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.export-container button {
    border: none !important;
    border-radius: 0 !important;
}

.format-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-color);
    border: none;
    border-left: 1px solid var(--border-color);
    padding: 0 10px;
    height: 36px;
    font-size: 13px;
    color: var(--text-color);
    cursor: pointer;
    outline: none;
}

.format-select:hover {
    background: var(--bg-color);
}

/* Status Bar */
.status-bar {
    background: var(--bg-surface);
    padding: 0.25rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--secondary-color);
    display: flex;
    justify-content: space-between;
}

/* Resizer */
.col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 100;
}

.col-resizer:hover {
    background: var(--primary-color);
    opacity: 0.5;
}

.row-resizer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: row-resize;
    z-index: 100;
}

.row-resizer:hover {
    background: var(--primary-color);
    opacity: 0.5;
}

/* Animations & Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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