/* ==============================
   Ferramentaria — app.css
   Bootstrap 5 custom overrides
   ============================== */

/* --- Layout -----------------------------------------------------------------*/
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 68px;
    --topbar-height: 60px;
    --sidebar-bg: #1a1d23;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active: rgba(79,139,249,.18);
    --primary: #4f8bf9;
}

body {
    font-size: 0.875rem;
    background: #f4f6fb;
    color: #212529;
}

/* --- Sidebar ----------------------------------------------------------------*/
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: min-width .25s ease, max-width .25s ease, width .25s ease;
    overflow-x: hidden;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand .brand-text {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    margin-left: .6rem;
    transition: opacity .2s;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: .55rem 1rem;
    color: rgba(255,255,255,.65);
    border-radius: .375rem;
    margin: 1px .5rem;
    white-space: nowrap;
    font-size: .84rem;
    transition: background .15s, color .15s;
    text-decoration: none;
    overflow: hidden;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar .nav-label {
    margin-left: .6rem;
    transition: opacity .2s;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-section-title {
    padding: 1rem 1.5rem .3rem;
    font-size: .65rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    white-space: nowrap;
}

/* --- Topbar ----------------------------------------------------------------*/
.topbar {
    top: 0;
    position: sticky;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

/* --- Main content ----------------------------------------------------------*/
#content-wrapper {
    min-width: 0;
    min-height: 100vh;
}

.page-content {
    padding: 1.5rem;
}

/* --- Stat cards ------------------------------------------------------------*/
.card-stat {
    border-radius: .75rem;
    border: none;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
    transition: transform .15s, box-shadow .15s;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* --- Avatars ----------------------------------------------------------------*/
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* --- Tables ----------------------------------------------------------------*/
.table th {
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600;
    color: #6c757d;
}

/* --- Forms -----------------------------------------------------------------*/
.form-label {
    font-weight: 500;
    font-size: .8rem;
    color: #495057;
    margin-bottom: .35rem;
}

/* --- Badges ----------------------------------------------------------------*/
.badge {
    font-size: .7rem;
    padding: .3em .6em;
    font-weight: 600;
}

/* --- Cards general ---------------------------------------------------------*/
.card {
    border-radius: .75rem;
}

/* --- Print -----------------------------------------------------------------*/
@media print {
    .sidebar, .topbar, .btn, .nav { display: none !important; }
    .main-content { margin-left: 0 !important; padding-top: 0 !important; }
}

/* --- Responsive ------------------------------------------------------------*/
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        max-width: var(--sidebar-width) !important;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    #content-wrapper {
        width: 100%;
    }
}
