* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #333;
}

/* Logout - top right */
.logout-topright {
    position: fixed;
    top: 12px;
    right: 15px;
    background: #8b1515;
    color: white !important;
    padding: 7px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88em;
    z-index: 1100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.logout-topright:hover { background: #6a1010; }

/* Horizontal Navigation Menu (like the example) */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: linear-gradient(to bottom, #c62828, #b71c1c);
    display: flex;
    align-items: stretch;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    border-bottom: 3px solid #8b1515;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92em;
    white-space: nowrap;
    transition: background 0.2s;
    border-right: 1px solid rgba(255,255,255,0.15);
}

.nav-item:last-child { border-right: none; }

.nav-item:hover {
    background: rgba(255,255,255,0.12);
}

.nav-item.active {
    background: linear-gradient(to bottom, #ffeb3b, #fbc02d);
    color: #1a2a6c;
    font-weight: 700;
    border-right-color: transparent;
}

/* Downward pointer on active tab (like the example) */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #fbc02d;
    z-index: 1001;
}

.page-layout {
    padding-top: 70px;
    min-height: 100vh;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 25px 40px 25px;
}

.logo-container {
    margin: 5px 0 15px 0;
    display: flex;
    justify-content: center;
}

.emblem-logo {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    border-radius: 8px;
}

.dashboard-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
}

.dashboard-box.wide { text-align: left; }

.welcome-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
    margin-bottom: 25px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Sidebar - collapsible to icons, expands on hover */
.sidebar-menu {
    width: 70px;
    min-width: 70px;
    background: linear-gradient(180deg, #1a2a6c 0%, #0d1b4a 100%);
    padding: 0;
    position: fixed;
    left: 0;
    top: 52px;
    bottom: 0;
    overflow: hidden;
    z-index: 100;
    box-shadow: 3px 0 12px rgba(0,0,0,0.3);
    border-right: 3px solid #b21f1f;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.sidebar-menu:hover {
    width: 260px;
    min-width: 260px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    background: rgba(178, 31, 31, 0.25);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo {
    font-size: 1.4em;
    color: #fdbb2d;
    min-width: 24px;
    text-align: center;
}

.sidebar-title {
    color: #fdbb2d;
    font-weight: 700;
    font-size: 1.15em;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-menu:hover .sidebar-title {
    opacity: 1;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e0e7ff;
    text-decoration: none;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.92em;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    margin: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-item .icon {
    font-size: 1.15em;
    width: 24px;
    min-width: 24px;
    text-align: center;
}

.sidebar-item .text {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-menu:hover .sidebar-item .text {
    opacity: 1;
}

.sidebar-item:hover {
    background: rgba(178, 31, 31, 0.4);
    border-left-color: #fdbb2d;
    color: white;
}

/* Submenu under Maklumat Kawasan */
.submenu {
    background: rgba(0,0,0,0.2);
    margin: 4px 8px 8px 28px;
    border-radius: 6px;
    overflow: hidden;
}
.submenu-item {
    display: block;
    color: #d0d7ff;
    text-decoration: none;
    padding: 8px 14px;
    font-size: 0.88em;
    font-weight: 500;
    border-left: 3px solid transparent;
}
.submenu-item:hover,
.submenu-item.active {
    background: rgba(178, 31, 31, 0.45);
    border-left-color: #fdbb2d;
    color: white;
}

.main-content.with-sidebar {
    margin-left: 80px;
    transition: margin-left 0.3s ease;
}

.sidebar-menu:hover ~ .main-content.with-sidebar,
.page-layout:hover .main-content.with-sidebar {
    /* optional: push content when expanded - remove if you want overlay */
}

/* Welcome note with clear white background box */
.welcome-box {
    background: #ffffff;
    padding: 30px 35px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    text-align: center;
    max-width: 520px;
    margin: 20px auto;
    border: 1px solid #e0e0e0;
}

.welcome-box h2 {
    color: #1a2a6c;
    margin-bottom: 12px;
    font-size: 1.7em;
}

.welcome-box p {
    color: #333;
    margin: 6px 0;
    font-size: 1.05em;
}

.btn-detail {
    background: #1a2a6c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}
.btn-detail:hover { background: #0d1a4a; }

.info-block {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.info-block h4 {
    color: #1a2a6c;
    margin: 0 0 12px 0;
    font-size: 1.15em;
    border-bottom: 2px solid #fdbb2d;
    padding-bottom: 6px;
}

.info-row {
    margin: 8px 0;
    line-height: 1.4;
}

.info-row .label {
    font-weight: 600;
    color: #333;
    display: inline-block;
    min-width: 140px;
}

.alamat-cell {
    white-space: pre-line;
}

/* Search form */
.search-form { max-width: 500px; margin: 20px auto; text-align: left; }
.radio-group { display: flex; gap: 20px; margin-top: 8px; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-weight: normal; }
select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 1em; }

/* Tables */
.table-wrapper { overflow-x: auto; margin-top: 15px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9em; background: white; }
.data-table th, .data-table td { padding: 10px 12px; border: 1px solid #ddd; text-align: left; }
.data-table th { background: #1a2a6c; color: white; font-weight: 600; }
.data-table tr:nth-child(even) { background: #f8f9fa; }
.data-table tr:hover { background: #eef2ff; }
.record-count { margin-top: 12px; font-weight: 600; color: #1a2a6c; text-align: right; }
.alamat-cell { white-space: pre-line; min-width: 200px; font-size: 0.88em; }

/* Filter form */
.filter-form { background: #f8f9fa; padding: 15px 20px; border-radius: 8px; margin-bottom: 20px; text-align: left; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.filter-group { flex: 1; min-width: 180px; }
.filter-group label { font-size: 0.9em; margin-bottom: 4px; }
.btn-group { display: flex; gap: 10px; margin-top: 10px; }
.btn-group button { width: auto; padding: 10px 24px; }
.btn-cetak { background: #2e7d32 !important; }

/* Login styles */
.container { width: 100%; max-width: 500px; margin: 40px auto; text-align: center; }
.login-box { background: rgba(255,255,255,0.95); padding: 30px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
h2 { color: #1a2a6c; margin-bottom: 20px; font-size: 1.8em; }
.form-group { margin-bottom: 15px; text-align: left; }
label { display: block; margin-bottom: 5px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="email"] {
    width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 1em;
}
button {
    width: 100%; padding: 12px; background: linear-gradient(to right, #1a2a6c, #b21f1f);
    color: white; border: none; border-radius: 6px; font-size: 1.1em; cursor: pointer;
}
.error { background: #ffebee; color: #c62828; padding: 10px; border-radius: 6px; margin: 15px 0; border: 1px solid #ffcdd2; }
.success { background: #e8f5e9; color: #2e7d32; padding: 10px; border-radius: 6px; margin: 15px 0; }
.register-link { margin-top: 15px; }
.register-link a { color: #b21f1f; }

/* Print */
@media print {
    .nav-bar, .logout-topright, .filter-form, .btn-group, .logo-container { display: none !important; }
    .page-layout { padding-top: 0 !important; }
    .main-content { padding: 0 !important; }
    .dashboard-box { box-shadow: none; border: none; }
    body { background: white; }
}

@media (max-width: 900px) {
    .nav-item { padding: 0 12px; font-size: 0.82em; }
    .emblem-logo { max-width: 150px; }
}
@media (max-width: 700px) {
    .nav-bar { flex-wrap: wrap; height: auto; padding: 4px 0; }
    .nav-item { padding: 8px 10px; }
    .nav-item.active::after { display: none; }
}

/* Submenu under Maklumat Kawasan - hover to show */
.submenu {
    max-height: 0;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
    margin: 0 8px 4px 20px;
    border-radius: 6px;
    transition: max-height 0.25s ease;
}
.sidebar-item:hover + .submenu,
.submenu:hover {
    max-height: 180px;
}
.submenu-item {
    display: block;
    color: #d0d7ff;
    text-decoration: none;
    padding: 8px 14px;
    font-size: 0.88em;
    font-weight: 500;
    border-left: 3px solid transparent;
}
.submenu-item:hover,
.submenu-item.active {
    background: rgba(178, 31, 31, 0.45);
    border-left-color: #fdbb2d;
    color: white;
}
