:root {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent-color: #0a84ff;
    --separator: #38383a;

    /* Gradients */
    --grad-orange: linear-gradient(135deg, #ff9500 0%, #ff5e3a 100%);
    --grad-purple: linear-gradient(135deg, #5e5ce6 0%, #bf5af2 100%);
    --grad-green: linear-gradient(135deg, #30d158 0%, #30db5b 100%);
    --grad-yellow: linear-gradient(135deg, #ffd60a 0%, #ffb340 100%);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overscroll-behavior-y: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Dashboard Header */
.dashboard-header {
    padding: 20px 20px 10px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 100;
}

.dashboard-header h1 {
    font-size: 34px;
    font-weight: 700;
    margin: 0 0 15px 0;
}

.search-bar-container {
    background: #1c1c1e;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.search-icon {
    color: var(--text-secondary);
}

#search-input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 17px;
    width: 100%;
}

.header-monitor-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

#storage-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.progress-bar-bg-dark {
    flex: 1;
    height: 6px;
    background: #3a3a3c;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill-gradient {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0a84ff, #5e5ce6);
    transition: width 0.3s ease;
}

/* Dashboard Content */
.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px 100px 20px;
    -webkit-overflow-scrolling: touch;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 25px 0 15px 0;
    color: var(--text-primary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 100px 100px;
    gap: 15px;
}

.widget-card {
    border-radius: 12px;
    padding: 15px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.1s;
}

.widget-card:active {
    transform: scale(0.97);
}

.widget-card h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.widget-icon {
    font-size: 32px;
    align-self: flex-end;
    z-index: 2;
}

/* Specific Widget Styles */
.widget-notepad {
    background: var(--grad-orange);
}

.widget-last-img {
    background: var(--grad-purple);
}

.widget-last-video {
    background: var(--grad-green);
}

.widget-draw {
    background: var(--grad-yellow);
    color: black;
}

.widget-draw h3 {
    text-shadow: none;
}

/* Media Previews in Widgets */
#last-img-preview,
#last-video-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    z-index: 1;
    border-radius: 12px;
}

/* File List & View Toggle */
.list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 15px;
}

.list-controls .section-title {
    margin: 0;
}

.view-toggle {
    background: #2c2c2e;
    border-radius: 8px;
    padding: 2px;
    display: flex;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.toggle-btn.active {
    background: #636366;
    color: white;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* File Card Styles */
.file-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.list-view .file-card {
    flex-direction: row;
    aspect-ratio: auto;
    height: 60px;
    padding: 5px 10px;
}

.file-preview {
    width: 100%;
    height: 70%;
    object-fit: cover;
    border-radius: 8px;
    background: #2c2c2e;
    margin-bottom: 8px;
}

.file-icon-placeholder {
    width: 100%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #2c2c2e;
    border-radius: 8px;
    color: var(--text-secondary);
}

.list-view .file-preview,
.list-view .file-icon-placeholder {
    width: 40px;
    height: 40px;
    margin: 0 15px 0 0;
}

.file-info-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    gap: 2px;
}

.file-grid .file-info-col {
    width: 100%;
    align-items: center;
}

.file-name {
    font-size: 12px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-view .file-name {
    text-align: left;
    font-size: 14px;
}

.file-size {
    font-size: 10px;
    color: var(--text-secondary);
}

.list-view .file-size {
    text-align: left;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-view .delete-btn {
    position: static;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    width: 30px;
    height: 30px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1c1c1e;
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.large-modal {
    max-width: 600px;
    height: 80vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close-modal {
    background: #3a3a3c;
    border: none;
    color: white;
    font-size: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
}

textarea#notepad-area {
    width: 100%;
    height: 200px;
    background: #2c2c2e;
    border: none;
    border-radius: 8px;
    color: white;
    padding: 10px;
    font-size: 16px;
    font-family: inherit;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#notepad-filename {
    background: #2c2c2e;
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    flex: 1;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn {
    background: #3a3a3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.canvas-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    touch-action: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.colors {
    display: flex;
    gap: 8px;
    flex: 1;
}

.color-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #3a3a3c;
    cursor: pointer;
}

/* FAB, Toast, Drop Overlay (Similar to before) */
.fab {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--accent-color);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 200;
    cursor: pointer;
}

.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drop-overlay.hidden {
    display: none;
}

.drop-content {
    border: 2px dashed var(--accent-color);
    padding: 40px;
    border-radius: 20px;
    color: var(--accent-color);
    font-weight: bold;
    background: #1c1c1e;
}

.status-toast {
    position: fixed;
    bottom: 100px;
    left: 20px;
    right: 20px;
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-toast.hidden {
    display: none;
}

.status-progress-bg {
    height: 4px;
    background: #48484a;
    border-radius: 2px;
}

.status-progress-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
}