/*
 * Custom Styles — Sistem PKL SMK
 * File: resources/css/style.css
 * Diproduksi di: public/css/style.css (same content)
 */

/* ══ Variables ══════════════════════════════════════════════════════════ */
:root {
    --sb-w:        260px;
    --sb-bg:       #0f172a;
    --sb-bg2:      #1a2744;
    --sb-active:   #4A90E2;
    --sb-active-bg:rgba(74, 144, 226, .14);
    --sb-text:     rgba(255, 255, 255, .72);
    --sb-muted:    rgba(255, 255, 255, .32);
    --sb-hover:    rgba(255, 255, 255, .06);
    --sb-border:   rgba(255, 255, 255, .08);
    --tb-h:        62px;
    --app-bg:      #f1f5f9;
}

/* ══ Sidebar ════════════════════════════════════════════════════════════ */
.app-sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sb-w); height: 100vh;
    background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg2) 100%);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto; overflow-x: hidden;
}
.app-sidebar::-webkit-scrollbar              { width: 3px; }
.app-sidebar::-webkit-scrollbar-thumb        { background: rgba(255,255,255,.12); border-radius: 99px; }

/* Brand */
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid var(--sb-border);
    text-decoration: none; color: #fff;
    flex-shrink: 0;
}
.sidebar-brand:hover            { color: #fff; }
.sidebar-brand-text             { font-weight: 800; font-size: .84rem; line-height: 1.25; }
.sidebar-brand-text small       { font-weight: 500; font-size: .68rem; color: var(--sb-muted); display: block; margin-top: 1px; }

/* Nav */
.sidebar-nav { flex: 1; padding: 10px 0 4px; }

/* Links */
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px 9px 18px;
    margin: 1px 8px;
    color: var(--sb-text); text-decoration: none;
    font-size: .836rem; font-weight: 600;
    border-radius: 10px;
    transition: background .15s, color .15s;
}
.sidebar-link i                 { font-size: .92rem; flex-shrink: 0; width: 18px; text-align: center; }
.sidebar-link:hover             { background: var(--sb-hover); color: #fff; }
.sidebar-link.active {
    background: var(--sb-active-bg);
    color: var(--sb-active);
    box-shadow: inset 0 0 0 1px rgba(74,144,226,.2);
}
.sidebar-link.active i          { color: var(--sb-active); }
.sidebar-link .sb-badge {
    margin-left: auto; background: #ef4444;
    color: #fff; font-size: .6rem; font-weight: 700;
    padding: 2px 7px; border-radius: 99px; line-height: 1.5;
}

/* Divider */
.sb-divider { height: 1px; background: var(--sb-border); margin: 6px 18px; }

/* ══ Collapsible groups (admin) ═════════════════════════════════════════ */
.sb-group { margin: 2px 0; }
.sb-group-header {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px 9px 18px; margin: 0 8px;
    cursor: pointer; user-select: none;
    color: var(--sb-muted); font-size: .75rem; font-weight: 700;
    letter-spacing: .04em; border-radius: 10px;
    transition: background .15s, color .15s;
}
.sb-group-header i.group-icon   { font-size: .88rem; width: 18px; text-align: center; flex-shrink: 0; }
.sb-group-header:hover          { background: var(--sb-hover); color: rgba(255,255,255,.65); }
.sb-group.open .sb-group-header { color: rgba(255,255,255,.7); }
.sb-group-header .sb-arrow      { margin-left: auto; font-size: .68rem; transition: transform .22s ease; flex-shrink: 0; }
.sb-group.open .sb-group-header .sb-arrow { transform: rotate(180deg); }
.sb-group-items                 { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.sb-group.open .sb-group-items  { max-height: 400px; }
.sb-group-items .sidebar-link   { padding-left: 46px; font-size: .818rem; position: relative; }
.sb-group-items .sidebar-link::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; opacity: .35;
    position: absolute; left: 28px;
}
.sb-group-items .sidebar-link.active::before { opacity: 1; background: var(--sb-active); }

/* ══ Sidebar footer ═════════════════════════════════════════════════════ */
.sidebar-footer { border-top: 1px solid var(--sb-border); padding: 10px; flex-shrink: 0; }
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px;
    color: var(--sb-text); text-decoration: none;
    transition: background .15s;
}
.sidebar-user:hover             { background: var(--sb-hover); color: #fff; }
.sidebar-user-name              { font-size: .82rem; font-weight: 700; color: #fff; line-height: 1.25; }
.sidebar-user-role              { font-size: .68rem; color: var(--sb-muted); }
.sidebar-user-avatar {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--sb-active); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .88rem; font-weight: 800; flex-shrink: 0;
    overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ══ App main wrapper ═══════════════════════════════════════════════════ */
.app-main {
    margin-left: var(--sb-w); min-height: 100vh;
    display: flex; flex-direction: column; background: var(--app-bg);
}

/* ══ Topbar ═════════════════════════════════════════════════════════════ */
.app-topbar {
    position: sticky; top: 0; height: var(--tb-h);
    background: #fff; border-bottom: 1px solid #e2e8f0;
    z-index: 100; display: flex; align-items: center;
    gap: 8px; padding: 0 24px; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.topbar-toggle {
    display: none; border: none; background: none;
    font-size: 1.2rem; color: #64748b; cursor: pointer;
    padding: 6px 8px; border-radius: 8px; line-height: 1;
    transition: background .15s; flex-shrink: 0;
}
.topbar-toggle:hover            { background: #f1f5f9; color: #1e293b; }
.topbar-title {
    font-size: .88rem; font-weight: 700; color: #1e293b; flex: 1;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-right                   { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.topbar-year-badge {
    font-size: .68rem; font-weight: 700;
    background: #eff6ff; color: #3b82f6;
    padding: 4px 10px; border-radius: 99px;
    border: 1px solid #bfdbfe; white-space: nowrap;
    margin-right: 4px;
}

/* Topbar icon button (notifikasi) */
.topbar-icon-btn {
    position: relative; border: none; background: none;
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #64748b; font-size: 1.05rem; cursor: pointer;
    transition: background .15s, color .15s;
}
.topbar-icon-btn:hover          { background: #f1f5f9; color: #1e293b; }
.topbar-icon-btn .notif-dot {
    position: absolute; top: 4px; right: 3px;
    background: #ef4444; color: #fff;
    font-size: .52rem; font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 99px; padding: 0 3px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; line-height: 1;
}
.notif-dropdown { width: 340px !important; }
@media (max-width: 400px) { .notif-dropdown { width: calc(100vw - 16px) !important; } }

/* Topbar user button */
.topbar-user-btn {
    display: flex; align-items: center; gap: 8px;
    border: none; background: none;
    padding: 4px 8px 4px 4px; border-radius: 10px;
    cursor: pointer; transition: background .15s; color: #1e293b;
}
.topbar-user-btn:hover          { background: #f1f5f9; }
.topbar-user-btn .topbar-avatar {
    width: 32px; height: 32px; border-radius: 8px; object-fit: cover;
    background: var(--sb-active); color: #fff; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 800; overflow: hidden;
}
.topbar-user-btn .topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-username { font-size: .82rem; font-weight: 700; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-chevron  { font-size: .68rem; color: #94a3b8; }

/* ══ App content ════════════════════════════════════════════════════════ */
.app-content { flex: 1; padding: 28px; }

/* ══ Mobile overlay ═════════════════════════════════════════════════════ */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1039; }

/* ══ Profile image (legacy) ═════════════════════════════════════════════ */
.profile-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

/* ══ Responsive ═════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .app-sidebar                { transform: translateX(-100%); }
    .app-sidebar.open           { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.35); }
    .app-main                   { margin-left: 0; }
    .topbar-toggle              { display: flex; }
    .sidebar-overlay.open       { display: block; }
}
@media (max-width: 575px) {
    .app-content                { padding: 16px 16px 32px; }
    .app-topbar                 { padding: 0 16px; }
    .topbar-username,
    .topbar-chevron             { display: none; }
    .topbar-year-badge          { display: none; }
}
