/* ========================================================
   ME-OFFICE UBK - MODERN DESIGN SYSTEM & STYLESHEET
   Universitas Bung Karno
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #1a365d;
    --primary-light: #2b4c7e;
    --primary-dark: #0f223d;
    --accent: #d97706;
    --accent-hover: #b45309;
    --secondary: #475569;
    --success: #059669;
    --info: #0284c7;
    --warning: #eab308;
    --danger: #dc2626;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography & Titles */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--primary-dark);
}

/* Navbar */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 4px 15px rgba(15, 34, 61, 0.15);
    padding: 0.75rem 1.5rem;
}

.navbar-custom .navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-custom .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    font-size: 0.925rem;
    padding: 0.5rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12);
}

/* Card Styling */
.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card-custom:hover {
    box-shadow: var(--shadow-hover);
}

.card-header-custom {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.1rem 1.25rem;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Auth Pages (Login & Register) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f223d 0%, #1a365d 50%, #2a4365 100%);
    position: relative;
    padding: 2.5rem 1rem;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 20% 20%, rgba(217, 119, 6, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(2, 132, 199, 0.15) 0%, transparent 40%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 2.5rem;
    position: relative;
    z-index: 10;
}

.auth-card-wide {
    max-width: 760px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(26, 54, 93, 0.08);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Attendance Widget */
.attendance-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.attendance-hero::after {
    content: '';
    position: absolute;
    right: -50px;
    bottom: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.digital-clock {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Stat Box */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.3rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(26, 54, 93, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(234, 179, 8, 0.12); color: var(--accent); }
.stat-icon.info { background: rgba(2, 132, 199, 0.1); color: var(--info); }
.stat-icon.danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* News Section Cards */
.news-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s, box-shadow 0.2s;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.news-thumb {
    height: 180px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.news-card:hover .news-thumb img {
    transform: scale(1.05);
}

.news-body {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.news-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Admin Sidebar Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #94a3b8;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 0.85rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.sidebar-link i {
    font-size: 1.1rem;
    color: #94a3b8;
    transition: color 0.2s;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active i,
.sidebar-link:hover i {
    color: #38bdf8;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 2px 7px;
    border-radius: 20px;
}

.admin-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow-x: hidden;
}

.admin-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-content {
    padding: 1.75rem;
    flex-grow: 1;
}

/* User Avatar & Badges */
.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.avatar-circle-lg {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.badge-role {
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 50px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hierarchy Tree View (Organisasi) */
.org-tree {
    list-style: none;
    padding-left: 0;
}

.org-tree ul {
    list-style: none;
    padding-left: 2rem;
    position: relative;
}

.org-tree ul::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 15px;
    left: 0.75rem;
    width: 2px;
    background: #cbd5e1;
}

.org-tree li {
    position: relative;
    margin-bottom: 0.85rem;
}

.org-tree li::before {
    content: '';
    position: absolute;
    top: 1.2rem;
    left: -1.25rem;
    width: 1.25rem;
    height: 2px;
    background: #cbd5e1;
}

.org-node {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.2rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.org-node.level-1 { border-left-color: #dc2626; }
.org-node.level-2 { border-left-color: #2563eb; }
.org-node.level-3 { border-left-color: #059669; }
.org-node.level-4 { border-left-color: #d97706; }

/* Map Container */
#map-container {
    height: 280px;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    z-index: 1;
}

/* Custom Buttons */
.btn-primary-custom {
    background: var(--primary);
    color: #ffffff;
    border: none;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-primary-custom:hover {
    background: var(--primary-light);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.25);
}

.btn-accent-custom {
    background: var(--accent);
    color: #ffffff;
    border: none;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-accent-custom:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

/* ========================================================
   RESPONSIVE DESIGN SYSTEM (MOBILE & TABLET FRIENDLY)
   Mendukung Smartphone (<576px), Tablet (576px-991px), Desktop (>=992px)
   ======================================================== */

/* Backdrop Overlay untuk Mobile Sidebar Drawer */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Touch-friendly scrolling pada seluruh tabel */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Tablet & Mobile Screens (< 992px) */
@media (max-width: 991.98px) {
    /* Admin Layout: Sidebar menjadi Drawer Offcanvas */
    .admin-layout {
        display: block;
        min-height: 100vh;
        width: 100%;
        position: relative;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 82vw;
        height: 100vh;
        height: 100dvh;
        background: #0f172a;
        z-index: 1060;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.6);
    }

    body.sidebar-open {
        overflow: hidden !important;
        touch-action: none;
    }

    /* Admin Topbar di Mobile & Tablet */
    .admin-topbar {
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1020;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    .admin-topbar .fs-5 {
        font-size: 1.05rem !important;
    }

    /* Admin Content di Mobile */
    .admin-content {
        padding: 1.15rem 0.85rem;
    }

    /* User Portal Navbar di Mobile */
    .navbar-custom {
        padding: 0.65rem 1rem;
    }

    .navbar-custom .navbar-collapse {
        background: rgba(15, 34, 61, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        margin: 0.75rem -1rem -0.65rem -1rem;
        padding: 1rem 1.25rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }

    .navbar-custom .nav-link {
        padding: 0.65rem 1rem !important;
        margin-bottom: 2px;
        font-size: 0.95rem;
    }

    .navbar-custom .dropdown-menu {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        margin: 0.25rem 0.75rem 0.5rem 0.75rem;
        border-radius: var(--radius-sm);
    }

    .navbar-custom .dropdown-item {
        color: #f8fafc !important;
        padding: 0.6rem 1rem;
    }

    .navbar-custom .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.15);
        color: #ffffff !important;
    }
}

/* Smartphone Small Screens (< 576px) */
@media (max-width: 575.98px) {
    /* Prevent iOS auto-zoom on input focus */
    .form-control,
    .form-select {
        font-size: 16px !important;
        min-height: 42px;
    }

    .form-control-sm,
    .form-select-sm {
        font-size: 15px !important;
        min-height: 38px;
    }

    /* Card Padding & Headers */
    .card-custom {
        border-radius: var(--radius-sm);
        margin-bottom: 0.85rem;
    }

    .card-body.p-4 {
        padding: 1rem !important;
    }

    .card-header-custom {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .card-header-custom > * {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Digital Clock di Hero Dashboard */
    .digital-clock {
        font-size: 1.75rem !important;
        letter-spacing: 1px;
    }

    /* Stat Cards di Mobile */
    .stat-card {
        padding: 0.85rem;
        gap: 0.75rem;
        border-radius: var(--radius-sm);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        border-radius: var(--radius-sm);
    }

    .stat-card .fs-4,
    .stat-card .fs-5 {
        font-size: 1.1rem !important;
    }

    /* Table adjustments */
    .table th,
    .table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Swipeable Nav Tabs di Smartphone */
    .nav-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        scrollbar-width: none;
    }

    .nav-pills::-webkit-scrollbar {
        display: none;
    }

    .nav-pills .nav-item {
        flex-shrink: 0;
    }

    /* Avatar Sizing di HP */
    .avatar-circle {
        width: 36px;
        height: 36px;
    }

    .avatar-circle-lg {
        width: 75px;
        height: 75px;
    }

    /* Modal Touch Enhancements */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: var(--radius-md);
    }

    .modal-body {
        max-height: calc(85vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer > * {
        width: 100%;
        margin: 0 !important;
    }

    /* Tombol-tombol mobile touch target */
    .btn-primary-custom,
    .btn-accent-custom {
        padding: 0.7rem 1.25rem;
        font-size: 0.95rem;
    }

    /* Map container di HP */
    #map-container {
        height: 260px !important;
    }

    /* Webcam video feed */
    #camera-feed {
        max-height: 260px !important;
    }

    /* Auth card di HP */
    .auth-card {
        padding: 1.75rem 1.25rem;
    }
}
