/**
 * MyCityBiz POS V2 Secure Development Workspace
 * Hosting File Manager Stylesheet
 */

:root {
    --bg-main: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #283548;
    --bg-hover: #334155;
    --bg-active: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --border-light: #475569;
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --accent: #38bdf8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    
    --sidebar-width: 260px;
    --header-height: 56px;
    --radius: 8px;
    --radius-lg: 12px;
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f8fafc;
    --bg-hover: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
}

.logo-badge {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.brand-text {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.nav-menu {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.nav-link:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: rgba(2, 132, 199, 0.18);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 12px 6px;
    font-weight: 600;
}

.storage-widget {
    padding: 16px;
    background-color: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-color);
}

.storage-title-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar {
    height: 6px;
    background-color: var(--bg-main);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-fill.warning { background-color: var(--warning); }
.progress-fill.danger { background-color: var(--danger); }

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bg-main);
}

.top-navbar {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 16px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.workspace-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    padding: 4px 12px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.role-badge {
    font-size: 11px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.role-badge.admin { background: #7c3aed; color: #fff; }
.role-badge.developer { background: #0284c7; color: #fff; }

/* Views Container */
.view-panel {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: none;
}
.view-panel.active {
    display: flex;
    flex-direction: column;
}

/* Toolbar & Breadcrumbs */
.toolbar-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    background: var(--bg-surface);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb-item {
    cursor: pointer;
    color: var(--accent);
    font-weight: 500;
}
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-separator { color: var(--text-muted); }

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    background: var(--bg-hover);
    color: var(--text-primary);
}
.btn:hover { background: var(--border-light); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: #ef4444; color: #fff; }

.search-input {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    outline: none;
    width: 180px;
}
.search-input:focus { border-color: var(--accent); }

/* File Table */
.file-table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex: 1;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.file-table th {
    background: var(--bg-surface-elevated);
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

.file-row:hover td {
    background-color: var(--bg-hover);
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
}
.file-name-cell:hover {
    color: var(--accent);
}

.item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.action-buttons {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.btn-icon {
    padding: 5px 8px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.btn-icon:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Integrated Code Editor */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.editor-header {
    background: var(--bg-surface-elevated);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-filename {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dirty-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning);
    display: none;
}
.dirty-indicator.visible { display: inline-block; }

.editor-textarea {
    flex: 1;
    width: 100%;
    height: calc(100vh - 220px);
    background: #090d16;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    border: none;
    outline: none;
    resize: none;
    white-space: pre;
    overflow: auto;
    tab-size: 4;
}

.editor-statusbar {
    background: var(--bg-surface-elevated);
    padding: 6px 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-backdrop.active { display: flex; }

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.2s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* API Tester styles */
.api-tester-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.api-request-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.method-select {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--accent);
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius);
    outline: none;
    font-size: 14px;
}

.url-input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 13px;
}

.api-response-box {
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #38bdf8;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 500;
        transition: left 0.3s ease;
    }
    .sidebar.open { left: 0; }
    .toolbar-container { flex-direction: column; align-items: stretch; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

