/* DriveHub – Main Stylesheet */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --success: #059669;
    --danger: #DC2626;
    --warning: #D97706;
    --bg: #F8F9FC;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #111827;
    --text-muted: #6B7280;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }

/* Page header */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h2 { font-size: 1.25rem; font-weight: 700; }
.folder-badge a { background: #EEF2FF; color: var(--primary); padding: 4px 10px; border-radius: 20px; font-size: .85rem; text-decoration: none; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: .875rem;
    font-weight: 500; cursor: pointer; border: none; text-decoration: none;
    transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #EEF2FF; color: var(--primary); }
.btn-secondary:hover { background: #E0E7FF; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: #FEF2F2; }
.btn-warning { background: #FEF3C7; color: var(--warning); }
.btn-success { background: #D1FAE5; color: var(--success); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-xs { padding: 3px 8px; font-size: .75rem; border-radius: 6px; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 5px; color: #374151; }
.form-group input, .form-group select, .form-input {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: .9rem; background: var(--surface);
    transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-group { display: flex; align-items: center; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-input-sm { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; }

/* Upload */
.upload-card { margin-bottom: 16px; }
.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 32px; text-align: center; cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary); background: #EEF2FF;
}
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-link { color: var(--primary); cursor: pointer; text-decoration: underline; }
.upload-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.progress-bar { background: var(--border); border-radius: 20px; height: 8px; margin: 12px 0; }
.progress-fill { background: var(--primary); height: 100%; border-radius: 20px; width: 60%; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form { display: flex; align-items: center; gap: 8px; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: .85rem; margin-bottom: 12px; color: var(--text-muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; }

/* File Grid */
.file-grid { display: flex; flex-direction: column; gap: 2px; }
.file-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 8px;
    background: var(--surface); border: 1px solid transparent;
    transition: border-color .15s, background .15s;
}
.file-item:hover { border-color: var(--border); background: var(--bg); }
.file-icon { font-size: 1.5rem; min-width: 36px; text-align: center; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: .9rem; font-weight: 500; color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: var(--primary); }
.folder-link { color: var(--primary); }
.file-meta { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }
.file-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.file-item:hover .file-actions { opacity: 1; }

/* Empty state */
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 40px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; margin: 10px 0 4px; }
.login-logo p { color: var(--text-muted); font-size: .9rem; }

/* Table */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { background: var(--bg); padding: 10px 12px; text-align: left; font-weight: 600; font-size: .8rem; border-bottom: 2px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.row-disabled { opacity: .5; }
.action-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* Badges */
.badge { padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-admin { background: #EDE9FE; color: #7C3AED; }
.badge-user { background: #D1FAE5; color: #065F46; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.status-dot.active { background: var(--success); }
.status-dot.inactive { background: #D1D5DB; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #1F2937; color: #fff; padding: 12px 20px;
    border-radius: 10px; font-size: .875rem;
    opacity: 0; transform: translateY(10px);
    transition: opacity .3s, transform .3s;
    pointer-events: none; z-index: 9999;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center; z-index: 500;
}
.modal-box {
    background: var(--surface); border-radius: 14px;
    padding: 28px; width: 90%; max-width: 440px;
    box-shadow: var(--shadow-md);
}
.modal-box h3 { margin-bottom: 16px; }

/* Misc */
.text-muted { color: var(--text-muted); font-size: .85rem; }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: .8rem; }

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .navbar { padding: 0 14px; }
    .container { padding: 16px 14px; }
    .file-actions { opacity: 1; }
}

/* ========== Public Folder Listing Page ========== */
.public-page { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.public-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px; height: 64px;
    box-shadow: var(--shadow);
}
.header-inner { max-width: 1100px; margin: 0 auto; height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 700; color: var(--primary); }

.public-main { flex: 1; max-width: 960px; margin: 0 auto; width: 100%; padding: 48px 20px; }

.public-hero { text-align: center; margin-bottom: 40px; }
.public-hero h1 { font-size: 2rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.public-hero p { color: var(--text-muted); font-size: 1rem; }

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.folder-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 20px 22px;
    text-decoration: none; color: var(--text);
    box-shadow: var(--shadow);
    transition: border-color .2s, box-shadow .2s, transform .15s;
}
.folder-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(79,70,229,.15);
    transform: translateY(-2px);
}
.folder-card-icon { font-size: 2.5rem; line-height: 1; }
.folder-card-info { flex: 1; min-width: 0; }
.folder-card-name { font-size: 1rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-card-sub { font-size: .8rem; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-card-arrow { font-size: 1.2rem; color: var(--primary); opacity: 0; transition: opacity .2s, transform .2s; }
.folder-card:hover .folder-card-arrow { opacity: 1; transform: translateX(4px); }

.empty-public { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-public p { margin-top: 12px; font-size: 1rem; }

.public-footer { text-align: center; padding: 20px; color: var(--text-muted); font-size: .8rem; }
.public-footer a { color: var(--text-muted); }

/* ========== Login – Folder badge ========== */
.back-link { display: inline-block; margin-bottom: 16px; font-size: .85rem; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--primary); }

.login-folder-badge {
    display: flex; align-items: center; gap: 12px;
    background: #EEF2FF; border: 1px solid #C7D2FE;
    border-radius: 10px; padding: 10px 16px;
    margin: 12px 0; text-align: left;
    font-size: .9rem;
}
.login-folder-badge span { font-size: 1.8rem; }
.login-folder-badge strong { display: block; font-weight: 700; }
.login-folder-badge small { color: var(--text-muted); font-size: .78rem; }

@media (max-width: 640px) {
    .folder-grid { grid-template-columns: 1fr; }
    .public-hero h1 { font-size: 1.5rem; }
}
