/* ============================================
   Sistem Informasi Akademik - Custom Styles
   Bootstrap 5.3 + Responsive Layout
   ============================================ */

:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --accent: #06b6d4;
    --sidebar-width: 270px;
    --topbar-height: 70px;
    --bg-body: #f0f4f8;
    --card-shadow: 0 4px 24px rgba(30, 58, 138, 0.08);
    --card-shadow-hover: 0 12px 40px rgba(30, 58, 138, 0.15);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    min-height: 100vh;
}

/* ---- Sidebar (Desktop) ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 50%, #1d4ed8 100%);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(30, 58, 138, 0.2);
    transition: var(--transition);
}

.sidebar-brand {
    text-align: center;
    padding: 28px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand .brand-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 28px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-brand h3 {
    font-weight: 700;
    font-size: 1.35rem;
    margin-bottom: 2px;
    letter-spacing: 1px;
}

.sidebar-brand p {
    font-size: 0.75rem;
    opacity: 0.75;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav .nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
    padding: 8px 16px 6px;
    margin-top: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.92rem;
}

.sidebar-nav a i {
    font-size: 1.15rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

.sidebar-nav a.active i {
    color: var(--primary-light);
}

.sidebar-footer {
    padding: 16px 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-footer a:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #fff;
}

.sidebar-footer a i {
    margin-right: 12px;
    font-size: 1.15rem;
}

/* ---- Offcanvas (Mobile Sidebar) ---- */
.offcanvas-sidebar {
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    width: var(--sidebar-width) !important;
    z-index: 1050;
}

.offcanvas-sidebar .sidebar-nav a,
.offcanvas-sidebar .sidebar-footer a {
    position: relative;
    z-index: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
}

.offcanvas-sidebar .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.offcanvas-sidebar .btn-close {
    filter: invert(1);
}

.offcanvas-sidebar .sidebar-nav a {
    color: rgba(255, 255, 255, 0.85);
}

.offcanvas-sidebar .sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
}

/* ---- Main Layout ---- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* ---- Topbar ---- */
.topbar {
    background: #fff;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 12px rgba(30, 58, 138, 0.06);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h4 {
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    font-size: 1.15rem;
}

.topbar-toggle {
    display: none;
    background: var(--primary);
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.topbar-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-dropdown .dropdown-toggle::after {
    margin-left: 8px;
    vertical-align: middle;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: #f1f5f9;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.user-info:hover,
.user-info.show {
    background: #e2e8f0;
}

.user-dropdown-menu {
    border: none;
    border-radius: 14px;
    padding: 8px;
    min-width: 220px;
    margin-top: 10px !important;
}

.user-dropdown-menu .dropdown-header {
    padding: 10px 14px;
}

.user-dropdown-menu .dropdown-item {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.user-dropdown-menu .dropdown-item:hover {
    background: #f1f5f9;
}

.user-dropdown-menu .logout-item:hover {
    background: #fef2f2;
    color: #dc3545 !important;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #334155;
}

.user-role {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* ---- Content Area ---- */
.content-area {
    padding: 28px;
    flex: 1;
}

.content-card {
    background: #fff;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.content-card .card-body {
    padding: 28px;
}

/* ---- Footer ---- */
.app-footer {
    text-align: center;
    padding: 18px;
    color: #94a3b8;
    font-size: 0.85rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

/* ---- Page Header (CRUD) ---- */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.5rem;
}

.page-subtitle {
    font-size: 0.9rem;
}

/* ---- Tables ---- */
.table-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card .table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
}

.table-card .table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border: none;
    white-space: nowrap;
}

.table-card .table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 0.9rem;
    border-color: #f1f5f9;
}

.table-card .table tbody tr {
    transition: var(--transition);
}

.table-card .table tbody tr:hover {
    background: #f8fafc;
}

.table-card .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(241, 245, 249, 0.5);
}

.btn-action {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* ---- Forms ---- */
.form-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.form-card .card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    font-weight: 600;
    padding: 16px 24px;
    border: none;
}

.form-card .card-body {
    padding: 28px;
}

.form-card .form-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.form-card .form-control,
.form-card .form-select {
    border-radius: 10px;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    transition: var(--transition);
}

.form-card .form-control:focus,
.form-card .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

/* ---- Dashboard ---- */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 60%, var(--accent) 100%);
    border-radius: var(--radius);
    padding: 32px;
    color: #fff;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.welcome-banner h2 {
    font-weight: 700;
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.welcome-banner p {
    opacity: 0.9;
    margin: 0;
    font-size: 0.95rem;
}

.welcome-banner .banner-icon {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 80px;
    opacity: 0.15;
}

.dashboard-card {
    border: none;
    border-radius: var(--radius);
    color: #fff;
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    display: block;
    box-shadow: var(--card-shadow);
}

.dashboard-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-hover);
    color: #fff;
}

.dashboard-card .card-body {
    padding: 24px;
    position: relative;
}

.dashboard-card .icon {
    font-size: 48px;
    opacity: 0.2;
    position: absolute;
    right: 20px;
    top: 15px;
}

.dashboard-card h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0;
}

.dashboard-card h5 {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
    opacity: 0.95;
}

.dashboard-card small {
    opacity: 0.8;
    font-size: 0.8rem;
}

.card-blue { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.card-green { background: linear-gradient(135deg, #047857, #10b981); }
.card-orange { background: linear-gradient(135deg, #c2410c, #f59e0b); }
.card-red { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.card-purple { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.card-teal { background: linear-gradient(135deg, #0e7490, #22d3ee); }

.quick-links {
    margin-top: 28px;
}

.quick-links h5 {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
}

.quick-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #475569;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 8px;
}

.quick-link-item:hover {
    background: var(--primary);
    color: #fff;
    transform: translateX(6px);
    box-shadow: var(--card-shadow);
}

.quick-link-item i {
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 10px;
    transition: var(--transition);
}

.quick-link-item:hover i {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ---- Login Page ---- */
.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 40%, var(--accent) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}

.login-page::before {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
}

.login-page::after {
    width: 300px;
    height: 300px;
    bottom: -80px;
    right: -80px;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    border: none;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: fadeInUp 0.8s ease;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.login-logo i {
    font-size: 38px;
    color: var(--primary);
}

.login-card .form-control {
    height: 48px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.9);
    padding-left: 14px;
}

.login-card .input-group-text {
    border-radius: 12px 0 0 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-right: none;
}

.login-card .input-group .form-control {
    border-left: none;
    border-radius: 0;
}

.login-card .input-group .password-toggle {
    border-radius: 0 12px 12px 0;
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    cursor: pointer;
}

.btn-login {
    height: 50px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    background: #fff;
    color: var(--primary);
    border: none;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    background: #fff;
    color: var(--primary-dark);
}

.login-footer-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
    margin-top: 24px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Badges ---- */
.badge-grade {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content-area {
        padding: 16px;
    }

    .content-card .card-body {
        padding: 16px;
    }

    .welcome-banner {
        padding: 24px;
    }

    .welcome-banner .banner-icon {
        display: none;
    }

    .welcome-banner h2 {
        font-size: 1.3rem;
    }

    .user-info .user-details {
        display: none;
    }

    .topbar-left h4 {
        font-size: 0.95rem;
    }
}

@media (max-width: 575.98px) {
    .page-header {
        text-align: center;
    }

    .page-header .btn {
        width: 100%;
    }

    .dashboard-card h2 {
        font-size: 1.6rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}
