/* 
=============================================
 KNKYX Onyx - Core Design System 
=============================================
*/

:root {
    /* Brand Colors */
    --primary-color: #4F46E5; /* Indigo 600 */
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    
    /* Backgrounds */
    --bg-main: #F9FAFB;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #111827;
    --bg-hover: #F3F4F6;
    
    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;
    
    /* Borders */
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* State Colors */
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* File Icon Colors */
    --color-folder: #FACC15;
    --color-pdf: #EF4444;
    --color-image: #10B981;
    --color-doc: #3B82F6;
    --color-archive: #8B5CF6;
    --color-unknown: #9CA3AF;

    /* Typo */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Layout & Shadows */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-main);
    line-height: 1.5;
    font-size: 14px;
    overflow: hidden; /* App feel */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 600;
}

/* =========================================
   Layout
   ========================================= */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* =========================================
   Sidebar
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.logo i {
    font-size: 28px;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: #fff;
    background-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.storage-info {
    padding: 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.storage-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.progress-bar {
    height: 4px;
    background-color: rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: var(--radius-full);
}

/* =========================================
   Main Content
   ========================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background-color: var(--bg-main);
}

/* Header */
.top-header {
    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 32px;
    flex-shrink: 0;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    width: 360px;
    transition: all 0.2s ease;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--bg-surface);
}

.search-bar i {
    color: var(--text-tertiary);
    font-size: 18px;
    margin-right: 8px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    cursor: pointer;
    border: 2px solid var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

/* Workspace */
.workspace {
    height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    overflow-y: auto;
    overflow-x: hidden;
}

.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-primary);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.breadcrumb-item:last-child {
    color: var(--text-primary);
    cursor: default;
}

.breadcrumb-item:not(:last-child):hover {
    color: var(--primary-color);
}

.workspace-actions {
    display: flex;
    gap: 12px;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    outline: none;
}

.btn i {
    font-size: 18px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.3);
}

.btn-outline {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    background-color: var(--bg-hover);
    border-color: #D1D5DB;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
}

.btn-text:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon i {
    font-size: 20px;
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* =========================================
   File List Table
   ========================================= */
.file-list-container {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.file-table th {
    padding: 16px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
    background-color: #FAFAFA;
}

.file-table td {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}

.file-row {
    transition: background-color 0.2s;
    cursor: default;
}

.file-row:hover {
    background-color: var(--bg-hover);
}

.file-row:last-child td {
    border-bottom: none;
}

.col-name { width: 50%; }
.col-size { width: 15%; }
.col-date { width: 25%; }
.col-actions { width: 10%; text-align: right; }

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 28px;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

.file-name:hover {
    text-decoration: underline;
    text-decoration-color: var(--border-color);
}

/* Colors for specific icons */
.color-folder { color: var(--color-folder); }
.color-pdf { color: var(--color-pdf); }
.color-image { color: var(--color-image); }
.color-doc { color: var(--color-doc); }
.color-archive { color: var(--color-archive); }

/* Row Actions */
.action-btn {
    opacity: 0;
    transform: scale(0.9);
}

.file-row:hover .action-btn {
    opacity: 1;
    transform: scale(1);
}

/* =========================================
   Empty State / Loading
   ========================================= */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

/* =========================================
   Modals
   ========================================= */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    animation: scaleIn 0.2s ease-out forwards;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background-color: #FAFAFA;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.form-control, .input-with-icon input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus, .input-with-icon input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 18px;
}

.input-with-icon input {
    padding-left: 40px;
}

/* Copy Link Area */
.share-result {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px dashed var(--border-color);
}

.copy-link-box {
    display: flex;
    gap: 8px;
}

.copy-link-box input {
    flex: 1;
    padding: 10px 14px;
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

/* =========================================
   Drag Overlay
   ========================================= */
.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(79, 70, 229, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
}

.drop-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.drop-content {
    text-align: center;
    pointer-events: none;
}

.drop-content i {
    font-size: 96px;
    margin-bottom: 24px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
        z-index: 100;
    }
    
    .search-bar {
        width: 200px;
    }
    
    .col-size, .col-date {
        display: none;
    }
}

/* =========================================
   CSS Spinner
   ========================================= */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

.spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.loading-cell {
    text-align: center;
    padding: 48px 24px !important;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* =========================================
   Breadcrumb Separator
   ========================================= */
.breadcrumb-sep {
    color: var(--text-tertiary);
    font-size: 14px;
    display: flex;
    align-items: center;
    user-select: none;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    cursor: default;
    font-weight: 600;
}

/* =========================================
   Context Menu
   ========================================= */
.context-menu {
    position: fixed;
    z-index: 3000;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 192px;
    animation: scaleIn 0.12s ease-out;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.context-menu-item i {
    font-size: 17px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.context-menu-item:hover {
    background: var(--bg-hover);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger i {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: #FEF2F2;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* =========================================
   Folder name cursor
   ========================================= */
.file-name.is-folder {
    cursor: pointer;
}

.file-name.is-folder:hover {
    color: var(--primary-color);
    text-decoration: none;
}
