/*B"H*/

:root {
    --void: #050505;
    --void-depth: #0a0a0a;
    --glass: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.1);
    --text-main: #e0e0e0;
    --text-dim: #666;
    --creation: #00f2ff;
    --energy: #bd00ff;
    --selection: rgba(0, 242, 255, 0.15);
    --font-mono: 'Courier New', Courier, monospace;
    --font-sans: system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    outline: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--void);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--void);
}
::-webkit-scrollbar-thumb {
    background: #222;
    border: 1px solid var(--void);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--creation);
    box-shadow: 0 0 10px var(--creation);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    height: 60px;
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1;
    position: relative;
}

.bsd-tag {
    font-size: 0.5rem;
    color: var(--text-dim);
    margin-bottom: 2px;
    opacity: 0.7;
    font-family: var(--font-mono);
}

.logo-text {
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(to right, var(--creation), var(--energy));
    -webkit-background-clip: text;
    color: transparent;
    font-size: 1.2rem;
}

.logo-sub {
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 4px;
    margin-top: 2px;
}

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.file-ops, .grid-ops {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-info-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filename {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-left: 10px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons */
.btn {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn:hover {
    border-color: var(--creation);
    color: var(--creation);
    background: rgba(0, 242, 255, 0.05);
}

.btn.glow {
    border-color: rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}

.btn.glow:hover {
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
}

.btn.icon {
    padding: 8px;
    width: 36px;
    text-align: center;
}

.btn.small {
    padding: 2px 6px;
    width: auto;
    font-size: 0.7rem;
    height: 20px;
    line-height: 1;
}

.btn.hidden {
    display: none;
}

/* Grid Container */
.grid-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background-image: 
        linear-gradient(var(--void-depth) 1px, transparent 1px),
        linear-gradient(90deg, var(--void-depth) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: -1px -1px;
}

/* Table */
table {
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 100%;
}

th, td {
    border: 1px solid var(--border);
    padding: 0;
    position: relative;
}

/* Header Cells */
th {
    background: var(--void);
    color: var(--text-dim);
    font-weight: normal;
    font-size: 0.75rem;
    padding: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    user-select: none;
}

/* Row Headers */
td.row-header {
    background: var(--void);
    color: var(--text-dim);
    font-size: 0.7rem;
    text-align: center;
    width: 40px;
    position: sticky;
    left: 0;
    z-index: 9;
    user-select: none;
    border-right: 1px solid var(--border);
}

/* Input Cells */
td.cell {
    min-width: 100px;
    height: 32px;
}

td.cell input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    display: block;
}

td.cell input:focus {
    background: var(--selection);
    box-shadow: inset 0 0 0 1px var(--creation);
}

/* Corner Header */
th.corner {
    z-index: 11;
    left: 0;
    top: 0;
    background: var(--void);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Loading State */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: var(--creation);
    font-family: var(--font-mono);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(5, 5, 5, 0.95);
    border: 1px solid var(--creation);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
    color: var(--creation);
    padding: 12px 24px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    letter-spacing: 1px;
}

.toast-notification.active {
    opacity: 1;
    transform: translateY(0);
}