:root {
    --bg-dark: #0f1115;
    --bg-surface: #1a1d24;
    --bg-surface-hover: #232832;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --accent: #63b3ed;
    --accent-hover: #4299e1;
    --border-color: #2d3748;
    --border-radius: 12px;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

.resizer:hover, .resizer.resizing {
    background: var(--border-color) !important;
}

input[type="text"], input[type="password"], input[type="email"], textarea, select {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
}

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

.sidebar {
    width: 300px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.sidebar p {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#property-list {
    flex: 1;
    overflow-y: auto;
    padding: 3px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.property-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.property-card:hover {
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--accent);
}

.property-card.active {
    border-color: var(--accent);
    background: rgba(99, 179, 237, 0.1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    background: radial-gradient(circle at top right, rgba(99,179,237,0.05), transparent);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.sticky-header {
    position: sticky;
    top: -32px;
    z-index: 100;
    background: var(--bg-dark);
    padding-top: 32px;
    padding-bottom: 20px;
    margin-top: -32px;
    margin-bottom: 20px;
}

.content-header h2 {
    margin: 0;
    font-size: 2rem;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit';
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

.hidden {
    display: none !important;
}

.active-state {
    display: block;
}

.hidden-state {
    display: none !important;
}

/* Folders Grid */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.folder-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.folder-card:hover {
    background: var(--bg-surface-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.folder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.8;
}

.folder-card h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Files List */
.files-list {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.file-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-card img, .file-card .icon {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-card a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card a:hover {
    color: var(--accent);
}

.uppy-container {
    margin-bottom: 32px;
}

/* Override Uppy Dark theme manually if needed to match background */
.uppy-Dashboard-inner {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
}

.prop-stats {
    font-size: 0.8em;
    color: #bbb;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}
.stat-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}
.stat-fill {
    height: 100%;
    background: var(--accent);
}
.stat-info {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

.explorer-row {
    display: flex;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.explorer-row:hover {
    background: rgba(255,255,255,0.05);
}

.explorer-row.selected {
    background: rgba(0, 150, 255, 0.15);
}

.breadcrumbs span:hover {
    text-decoration: underline;
}

.mobile-header {
    display: none;
}
.mobile-overlay {
    display: none;
}
.mobile-only {
    display: none !important;
}

/* Tree View Styles */
.folder-tree ul {
    list-style: none;
    padding-left: 20px;
    margin: 0;
}
.tree-node {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}
.tree-node:hover {
    background: rgba(255,255,255,0.05);
}
.tree-node.active {
    background: rgba(99, 179, 237, 0.15);
    color: var(--accent);
}
.tree-toggle {
    display: inline-block;
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
    transition: transform 0.2s;
    font-size: 0.8em;
}
.tree-toggle.open {
    transform: rotate(90deg);
}
.tree-icon {
    margin-right: 6px;
    font-size: 1.1em;
}
.tree-item-container {
    display: flex;
    flex-direction: column;
}
.tree-children {
    display: none;
}
.tree-children.open {
    display: block;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .mobile-header {
        display: flex;
        align-items: center;
        padding: 10px 16px;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        z-index: 900;
    }
    .mobile-only {
        display: block !important;
    }
    
    .sticky-header {
        top: -16px;
        padding-top: 16px;
        margin-top: -16px;
    }
    
    /* Sidebar as a Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1001;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
        border-right: none;
    }
    .sidebar.open {
        left: 0;
    }
    
    .mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .mobile-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    #property-list {
        max-height: none;
    }
    .main-content {
        padding: 3px;
        padding-bottom: calc(40px + env(safe-area-inset-bottom, 20px));
    }
    .content-header h2 {
        font-size: 1.5rem;
    }
    .explorer-layout {
        flex-direction: column !important;
        gap: 15px !important;
        overflow: visible !important;
    }
    .explorer-main {
        overflow: visible !important;
    }
    #tree-pane {
        display: none !important;
    }
    .explorer-table {
        overflow: visible !important;
    }
    #explorer-container {
        overflow: visible !important;
    }
    #preview-backdrop {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.7) !important;
        z-index: 1040 !important;
    }
    #preview-backdrop.hidden {
        display: none !important;
    }
    #preview-pane {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 400px !important;
        height: auto !important;
        max-height: 85vh !important;
        z-index: 1050 !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.5) !important;
        border: 1px solid var(--border-color) !important;
    }
    .explorer-table-header {
        display: none !important;
    }
    .explorer-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        padding: 12px 16px !important;
    }
    .explorer-row > div {
        text-align: left !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }
    /* Move the date/size to be less prominent */
    .explorer-row > div:nth-child(2),
    .explorer-row > div:nth-child(3) {
        font-size: 0.85em;
        padding-left: 34px; /* Align with text, avoiding icon */
    }
}
