/* S3 Manager Application Styling */
:root {
    --sidebar-width: 230px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0ea5e9;
    --sidebar-color: #cbd5e1;
    --navbar-height: 60px;
}

/* Base text size: everything (Bootstrap uses rem) scales from this. 14px suits a dense admin
   screen and stays readable on laptops that use Windows display scaling (125-150%). */
html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    min-height: 100vh;
}

/* Layout Wrapper */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-width);
    margin-left: 0;
    background-color: var(--sidebar-bg);
    transition: margin 0.25s ease-out;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

#sidebar-wrapper .sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar-wrapper .sidebar-nav {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    flex-grow: 1;
}

#sidebar-wrapper .nav-item {
    margin-bottom: 0.25rem;
}

#sidebar-wrapper .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--sidebar-color);
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.925rem;
    transition: all 0.15s ease-in-out;
}

#sidebar-wrapper .nav-link:hover {
    color: #ffffff;
    background-color: var(--sidebar-hover);
}

#sidebar-wrapper .nav-link.active {
    color: #ffffff;
    background-color: var(--sidebar-active);
}

#sidebar-wrapper .nav-link i {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
}

#sidebar-wrapper .sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Page Content Wrapper */
#page-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #f8fafc;
}

/* Top Navbar */
.top-navbar {
    height: var(--navbar-height);
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.75rem;
}

/* App Footer */
.app-footer {
    padding: 1rem 1.75rem;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}

/* Metric Cards */
.card-stat {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Long lists scroll inside their own box (height set by AppList.fit in app.js) */
.scroll-list {
    overflow-y: auto;
}

.scroll-list thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f8f9fa;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* Data tables: keep short values on one line, cut long paths with "…" (full text on hover) */
.cell-nowrap {
    white-space: nowrap;
}

.cell-truncate {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-compact > :not(caption) > * > * {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.table-compact thead th {
    white-space: nowrap;
}

/* Sortable table headers (see js/table-sort.js) */
th[data-sort] {
    cursor: pointer; /* hand cursor, shows it can be clicked */
    user-select: none; /* no text selection on double click */
    white-space: nowrap; /* keep title and arrow on one line */
}

th[data-sort]:hover {
    color: #0d6efd !important; /* blue on hover */
}

th[data-sort] .sort-icon {
    margin-left: 0.35rem; /* space between title and arrow */
    font-size: 0.8em; /* small arrow */
    opacity: 0.4; /* faint when not sorted */
}

th[data-sort].sorted {
    color: #0d6efd !important; /* blue on the sorted column */
}

th[data-sort].sorted .sort-icon {
    opacity: 1; /* full arrow on the sorted column */
}

/* Sort links on server-sorted tables (Activity Logs) */
.sort-link {
    color: inherit; /* same grey as other headers */
    text-decoration: none; /* no underline */
    white-space: nowrap; /* keep title and arrow on one line */
}

.sort-link:hover,
.sort-link.sorted {
    color: #0d6efd; /* blue on hover and on the sorted column */
}

.sort-link .sort-icon {
    margin-left: 0.35rem; /* space between title and arrow */
    font-size: 0.8em; /* small arrow */
    opacity: 0.4; /* faint when not sorted */
}

.sort-link.sorted .sort-icon {
    opacity: 1; /* full arrow on the sorted column */
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
        position: fixed;
    }
    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
}
