/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.5;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LOGIN === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 380px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

/* === FORM === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

input:focus, select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.input-sm {
    width: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    padding-top: 1.5rem;
}

/* === BUTTONS === */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { background: #f3f4f6; text-decoration: none; }

.btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}
.btn-danger:hover { background: #dc2626; }

.btn-full { width: 100%; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.8rem; }

.btn-view {
    background: #0d9488;
    color: #fff;
    border-color: #0d9488;
}
.btn-view:hover { background: #0f766e; color: #fff; }

/* === ALERTS === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* === TOPBAR === */
.topbar {
    background: #1e293b;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.topbar h1 { font-size: 1.2rem; font-weight: 600; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-label { font-size: 0.9rem; opacity: 0.85; }

.topbar .btn {
    color: #fff;
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
}
.topbar .btn:hover { background: rgba(255,255,255,0.2); }
.topbar .btn-danger { background: #ef4444; border-color: #ef4444; }

/* === CONTAINER === */
.container {
    max-width: 1600px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

/* === BREADCRUMB === */
.breadcrumb {
    padding: 0.6rem 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.breadcrumb a {
    color: #2563eb;
    font-weight: 500;
}

/* === TOOLBAR === */
.toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* === DROP ZONE === */
.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 0;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.drop-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}

.drop-zone-text {
    text-align: center;
    color: #9ca3af;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.drag-over .drop-zone-text {
    color: #2563eb;
    font-weight: 600;
}

/* === FILE TABLE === */
.file-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.file-table th,
.file-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.file-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.file-table tbody tr:hover { background: #f9fafb; }

.col-check { width: 35px; }
.col-name { min-width: 200px; }
.col-size { width: 100px; }
.col-date { width: 150px; }
.col-actions { width: 250px; white-space: nowrap; }

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #1e293b;
    font-weight: 500;
}

.file-link:hover { color: #2563eb; text-decoration: none; }

.folder-link { color: #d97706; }
.folder-link:hover { color: #b45309; }

.icon { font-size: 1.1rem; }

.actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.empty-row td {
    text-align: center;
    color: #9ca3af;
    padding: 2rem;
    font-style: italic;
}

/* === BULK ACTIONS === */
.bulk-actions {
    padding: 0.6rem 0;
    font-size: 0.9rem;
    color: #374151;
}

/* === MODAL === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* === UPLOAD PROGRESS === */
.upload-progress {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 999;
    min-width: 280px;
}

.upload-progress-inner {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: #2563eb;
    width: 0%;
    transition: width 0.2s;
    border-radius: 4px;
}

#uploadText {
    font-size: 0.85rem;
    color: #374151;
    white-space: nowrap;
}

/* === CARD === */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.15rem;
    color: #1e293b;
}

/* === ADMIN FORMS === */
.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e5e7eb;
    color: #374151;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

/* === USER TABLE === */
.user-table td {
    vertical-align: middle;
}

.user-table .actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

/* === PROJECT LINKS === */
.projects-cell {
    max-width: 250px;
}

.project-link {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    margin: 0.15rem 0.2rem;
    border-radius: 4px;
    font-size: 0.78rem;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    text-decoration: none;
}

.project-link:hover {
    background: #d1fae5;
    text-decoration: none;
}

/* === TABS === */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
    color: #1e293b;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* === DATABASE LIST === */
.db-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.db-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.db-table th,
.db-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.db-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.db-table tbody tr:hover { background: #f9fafb; }

.db-empty {
    text-align: center;
    color: #9ca3af;
    padding: 2rem;
    font-style: italic;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .topbar { flex-wrap: wrap; gap: 0.5rem; }
    .toolbar { flex-wrap: wrap; }
    .col-size, .col-date { display: none; }
    .col-actions { width: auto; }
    .form-inline { flex-direction: column; align-items: stretch; }
}
