/* =============================================
   DMS – Document Management System – Styles
   ============================================= */

:root {
    --sidebar-width: 260px;
    --navbar-height: 56px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --text-light: #94a3b8;
}

/* ---- General ---- */
body {
    background: #f1f5f9;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
}

a { text-decoration: none; }

/* ---- Navbar ---- */
.navbar-brand span { font-weight: 700; letter-spacing: .5px; }

/* ---- Sidebar ---- */
#sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--sidebar-bg);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform .25s ease;
}

#sidebar .sidebar-header {
    padding: 1rem 1.25rem .5rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
}

#sidebar .nav-link {
    color: #cbd5e1;
    padding: .55rem 1.25rem;
    border-radius: 6px;
    margin: 2px 8px;
    display: flex;
    align-items: center;
    gap: .6rem;
    transition: background .2s, color .2s;
}

#sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

#sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

#sidebar .nav-link i { width: 18px; text-align: center; }

/* Folder tree in sidebar */
.sidebar-tree { padding: 0 8px; }
.sidebar-tree .tree-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .5rem;
    border-radius: 5px;
    color: #94a3b8;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-tree .tree-item:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-tree .tree-item.active { background: var(--sidebar-active); color: #fff; }
.sidebar-tree .tree-item i      { color: #fbbf24; font-size: .85rem; }
.sidebar-tree .tree-children    { padding-left: 1rem; border-left: 1px solid #334155; margin-left: .75rem; }

/* ---- Main content ---- */
#main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 1.5rem;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left .25s ease;
}

/* ---- Cards ---- */
.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: 10px; }
.card-header { background: #fff; border-bottom: 1px solid #e2e8f0; font-weight: 600; }

/* ---- Stat cards ---- */
.stat-card { border-radius: 12px; padding: 1.25rem; color: #fff; }
.stat-card .stat-icon { font-size: 2rem; opacity: .7; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; opacity: .85; }

/* ---- Folder cards ---- */
.folder-card {
    border: 2px solid transparent;
    border-radius: 10px;
    padding: .85rem 1rem;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.folder-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.15); }
.folder-card i { font-size: 1.8rem; color: #fbbf24; }
.folder-card .folder-name { font-weight: 600; font-size: .9rem; color: #1e293b; }
.folder-card .folder-meta { font-size: .75rem; color: #64748b; }

/* ---- Document table ---- */
.doc-icon { font-size: 1.3rem; }
.badge-ext { font-size: .65rem; text-transform: uppercase; }

/* ---- Breadcrumb ---- */
.breadcrumb { background: transparent; padding: 0; margin: 0; }
.breadcrumb-item a { color: var(--primary); }
.breadcrumb-item.active { color: #64748b; }

/* ---- Upload zone ---- */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #f8fafc;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}
.upload-zone i { font-size: 2.5rem; color: #94a3b8; }

/* ---- Login page ---- */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card { border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-width: 400px; width: 100%; }
.login-logo i { font-size: 2.5rem; color: var(--primary); }

/* ---- Versiones timeline ---- */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: .45rem; top: 0; bottom: 0; width: 2px; background: #e2e8f0; }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.1rem; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }

/* ---- Historial ---- */
.his-badge { font-size: .7rem; padding: .25rem .55rem; }

/* ---- Utilities ---- */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bg-gradient-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; }
.bg-gradient-success { background: linear-gradient(135deg, #10b981, #059669) !important; }
.bg-gradient-warning { background: linear-gradient(135deg, #f59e0b, #d97706) !important; }
.bg-gradient-danger  { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }
.bg-gradient-info    { background: linear-gradient(135deg, #06b6d4, #0891b2) !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.show { transform: translateX(0); }
    #main-content { margin-left: 0; }
}

/* ---- SweetAlert custom ---- */
.swal2-popup { border-radius: 12px !important; }

/* ---- Table actions ---- */
.btn-action { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-size: .78rem; }

/* ---- Scrollbar sidebar ---- */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
