/* Reset & Base */
* {
    min-width: 0px;
    min-height: 0px;
    box-sizing: border-box;
}

/* Import Material Icons - MUST be at the top */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* CSS Variables */
.darkmuted {
    --b0: hsl(215, 25%, 8%);
    --b1: hsl(215, 25%, 12%);
    --b2: hsl(215, 25%, 16%);
    --b3: hsl(215, 25%, 20%);
    --b4: hsl(215, 25%, 30%);
    --b5: hsl(215, 25%, 40%);
    --f4: hsl(215, 25%, 55%);
    --f3: hsl(215, 25%, 70%);
    --f2: hsl(215, 25%, 85%);
    --f1: white;
    --blue0: #1e3a5f;
    --blue1: #2a4a7a;
    --blue2: #365a8a;
    --red2: #f44336;
}

/* Apply darkmuted to body */
body.darkmuted {
    background: var(--b0);
    color: var(--f2);
}

/* Layout Utilities */
.row { display: flex; flex-direction: row; }
.col { display: flex; flex-direction: column; }
.flex-grow { flex: 1; }
.flex-no-shrink { flex-shrink: 0; }
.align-center { align-items: center; }

/* Gap Utilities */
.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

/* Icon Styles - CRITICAL FIX */
.icon {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    -webkit-font-smoothing: antialiased;
}

/* Make sure icons render properly */
.icon:empty {
    display: inline-block;
}

/* Fix for specific icon classes to ensure they render as icons */
.btn .icon,
button .icon {
    pointer-events: none;
}

/* Button Styles */
.btn {
    background: var(--b2);
    color: var(--f2);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Comfortaa', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
}

.btn:hover:not(:disabled) {
    background: var(--b3);
    color: var(--f1);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.small {
    padding: 4px 8px;
    font-size: 13px;
}

.btn.primary {
    background: var(--blue1);
    color: white;
}

.btn.secondary {
    background: var(--b3);
}

.btn.tertiary {
    background: transparent;
}

.btn.iconOnly {
    padding: 8px;
}

.btn.iconOnly .icon {
    margin: 0px;
}

.btn:focus-visible {
    outline: 2px solid var(--f2);
    outline-offset: 2px;
}

/* Textbox Styles */
.textbox {
    background: var(--b2);
    border: 1px solid var(--b4);
    color: var(--f1);
    padding: 8px 12px;
    font-family: 'Comfortaa', monospace;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.textbox:focus {
    outline: none;
    border-color: var(--f3);
    background: var(--b1);
}

.textbox::placeholder {
    color: var(--f4);
    opacity: 0.7;
}

/* Separator */
.sep {
    width: 1px;
    height: 24px;
    background: var(--b4);
    margin: 0 4px;
}

/* Body Styles */
body {
    --fontDefault: 'Comfortaa', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-family: var(--fontDefault);
    margin: 0;
    padding: 0;
    background: var(--b0);
    color: var(--f2);
}

/* Main Container */
#main {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Navbar */
#navbar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--b3);
    background: var(--b1);
}

#navbar .btn {
    white-space: nowrap;
}

/* Controls */
#controls {
    padding: 8px 16px;
    border-bottom: 1px solid var(--b3);
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--b1);
}

#controls::-webkit-scrollbar {
    height: 3px;
    background: transparent;
}

#controls::-webkit-scrollbar-thumb {
    background: var(--b4);
    border-radius: 3px;
}

#controls .sep {
    width: 1px;
    height: 20px;
    margin: 0px 5px;
    background-color: var(--b3);
}

/* File Column Headings */
#fileColHeadings {
    padding: 10px 24px 6px 24px;
    font-weight: bold;
    color: var(--b5);
    font-size: 14px;
    user-select: none;
    background: var(--b1);
    border-bottom: 1px solid var(--b3);
    display: flex;
    gap: 10px;
}

#fileColHeadings .name { flex: 1; }
#fileColHeadings .date { width: 150px; }
#fileColHeadings .size { width: 100px; }
#fileColHeadings .perms { width: 100px; }

/* Files Container */
#files {
    overflow-x: hidden;
    overflow-y: auto;
    height: 0px;
    padding: 4px;
    background: var(--b0);
}

#files > .section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 2px;
}

/* File Entry */
.fileEntry {
    display: flex;
    align-items: center;
    padding: 6px 20px;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
}

.fileEntry:hover {
    background: var(--b2);
}

.fileEntry > .icon {
    color: var(--f3);
    font-family: 'Material Symbols Rounded';
    flex-shrink: 0;
}

.fileEntry > .nameCont {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.fileEntry > .nameCont .name {
    color: var(--f1);
    font-weight: 500;
}

.fileEntry > .date,
.fileEntry > .size,
.fileEntry > .perms {
    flex-shrink: 0;
    font-size: 13px;
}

.fileEntry > .date { width: 150px; }
.fileEntry > .size { width: 100px; }
.fileEntry > .perms { width: 100px; font-family: monospace; }

.fileEntry.selected {
    background: var(--blue0);
}

.fileEntry.selected > .icon {
    color: var(--f1);
}

/* Progress Bar */
#progressBar {
    border-radius: 0px;
    margin: 0px;
    height: 3px;
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

#progressBar.visible {
    display: block;
}

/* Status Bar */
#statusBar {
    padding: 8px 10px 6px 10px;
    font-size: 14px;
    color: var(--f4);
    border-top: 1px solid var(--b3);
    background: var(--b1);
}

#statusBar.error {
    color: var(--red2);
}

/* Responsive Design */
@media (max-width: 640px) {
    .atLeast640px { display: none !important; }
}
@media (min-width: 641px) {
    .atMost640px { display: none !important; }
}
@media (max-width: 800px) {
    .atLeast800px { display: none !important; }
}
@media (min-width: 801px) {
    .atMost800px { display: none !important; }
}
@media (max-width: 1000px) {
    .atLeast1000px { display: none !important; }
}
@media (min-width: 1001px) {
    .atMost1000px { display: none !important; }
}

/* Utility Classes */
.hidden { display: none !important; }
.visible { display: block; }