/**
 * style.css - Sistem Informasi RT
 * Mobile-first responsive design
 * Warna: Primary #1a73e8, Secondary #34a853, Accent #fbbc04, Danger #ea4335
 */

/* ========================================
   CSS RESET & BASE
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1f2937;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: #1a73e8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   APP CONTAINER
   ======================================== */
.app-container {
    min-height: 100vh;
    padding-bottom: 80px; /* space for bottom nav */
}

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-body {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: #6b7280;
}

.login-footer a {
    color: #1a73e8;
    font-weight: 600;
}

.login-footer-small {
    margin-top: 8px;
    font-size: 11px;
    color: #9ca3af;
}

/* ========================================
   TOPBAR
   ======================================== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Menu open animation */
.mobile-menu-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 5px);
}

.mobile-menu-btn.open span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -5px);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-logo {
    font-size: 24px;
}

.topbar-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-notif {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.topbar-notif:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notif-icon {
    font-size: 20px;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ea4335;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #1557b0;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: linear-gradient(180deg, #1a73e8, #1557b0);
    z-index: 1200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.sidebar-user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: capitalize;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    text-decoration: none !important;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-nav-active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    border-left-color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    background: #ea4335;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

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

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none !important;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ========================================
   BOTTOM NAV (MOBILE)
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    border-top: 1px solid #e5e7eb;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 12px;
    color: #6b7280;
    font-size: 10px;
    text-decoration: none !important;
    border-radius: 8px;
    transition: all 0.2s;
    position: relative;
}

.bottom-nav-item:hover {
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.05);
}

.bottom-nav-active {
    color: #1a73e8;
}

.bottom-nav-active .bottom-nav-label {
    font-weight: 600;
}

.bottom-nav-icon {
    font-size: 20px;
    line-height: 1;
}

.bottom-nav-label {
    font-size: 10px;
    line-height: 1;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    padding: 72px 16px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 20px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: #6b7280;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.card-link {
    font-size: 13px;
    color: #1a73e8;
    font-weight: 500;
}

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

/* ========================================
   STATS GRID
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon-blue {
    background: rgba(26, 115, 232, 0.12);
}

.stat-icon-green {
    background: rgba(52, 168, 83, 0.12);
}

.stat-icon-yellow {
    background: rgba(251, 188, 4, 0.15);
}

.stat-icon-red {
    background: rgba(234, 67, 53, 0.12);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* ========================================
   QUICK ACTIONS
   ======================================== */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-actions .btn {
    margin: 0;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
    color: #ffffff;
}

.btn-success {
    background: linear-gradient(135deg, #34a853, #2d8f47);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(52, 168, 83, 0.3);
}

.btn-success:hover {
    box-shadow: 0 4px 14px rgba(52, 168, 83, 0.4);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, #ea4335, #d33426);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(234, 67, 53, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 14px rgba(234, 67, 53, 0.4);
    color: #ffffff;
}

.btn-outline {
    background: #ffffff;
    color: #1a73e8;
    border: 2px solid #1a73e8;
}

.btn-outline:hover {
    background: #1a73e8;
    color: #ffffff;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px; /* Prevent iOS zoom */
    font-family: inherit;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #9ca3af;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ========================================
   TABLES
   ======================================== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: #f9fafb;
}

th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 2px solid #e5e7eb;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f9fafb;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-success {
    background: rgba(52, 168, 83, 0.12);
    color: #2d8f47;
}

.badge-warning {
    background: rgba(251, 188, 4, 0.15);
    color: #b8860b;
}

.badge-danger {
    background: rgba(234, 67, 53, 0.12);
    color: #c62828;
}

.badge-info {
    background: rgba(26, 115, 232, 0.12);
    color: #1a5bb5;
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(52, 168, 83, 0.1);
    color: #2d8f47;
    border: 1px solid rgba(52, 168, 83, 0.2);
}

.alert-warning {
    background: rgba(251, 188, 4, 0.12);
    color: #b8860b;
    border: 1px solid rgba(251, 188, 4, 0.2);
}

.alert-danger {
    background: rgba(234, 67, 53, 0.1);
    color: #c62828;
    border: 1px solid rgba(234, 67, 53, 0.2);
}

.alert-info {
    background: rgba(26, 115, 232, 0.1);
    color: #1a5bb5;
    border: 1px solid rgba(26, 115, 232, 0.2);
}

/* ========================================
   FLASH MESSAGES
   ======================================== */
.flash-message {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

.flash-success {
    background: rgba(52, 168, 83, 0.12);
    color: #2d8f47;
    border: 1px solid rgba(52, 168, 83, 0.25);
}

.flash-warning {
    background: rgba(251, 188, 4, 0.15);
    color: #b8860b;
    border: 1px solid rgba(251, 188, 4, 0.25);
}

.flash-danger {
    background: rgba(234, 67, 53, 0.12);
    color: #c62828;
    border: 1px solid rgba(234, 67, 53, 0.25);
}

.flash-info {
    background: rgba(26, 115, 232, 0.12);
    color: #1a5bb5;
    border: 1px solid rgba(26, 115, 232, 0.25);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   LIST ITEMS
   ======================================== */
.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.list-item-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    font-size: 11px;
    color: #9ca3af;
}

.list-item-action {
    flex-shrink: 0;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    text-align: center;
    padding: 32px 16px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
    color: #9ca3af;
}

/* ========================================
   MODAL
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 0 20px 20px;
}

/* ========================================
   FILTER BAR
   ======================================== */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px 10px 38px;
    font-size: 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.search-input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

/* ========================================
   AVATAR
   ======================================== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 20px;
}

/* ========================================
   GRIDS
   ======================================== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* ========================================
   STATUS DOTS
   ======================================== */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot-green {
    background: #34a853;
}

.status-dot-red {
    background: #ea4335;
}

.status-dot-yellow {
    background: #fbbc04;
}

/* ========================================
   RESPONSIVE - TABLET (>= 768px)
   ======================================== */
@media (min-width: 768px) {
    .app-container {
        padding-bottom: 0;
        margin-left: 260px;
    }

    .bottom-nav {
        display: none;
    }

    .sidebar {
        left: 0 !important;
        z-index: 900;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .topbar {
        left: 260px;
    }

    .mobile-menu-btn {
        display: none;
    }

    .main-content {
        padding: 72px 24px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .page-title {
        font-size: 26px;
    }
}

/* ========================================
   RESPONSIVE - DESKTOP (>= 1024px)
   ======================================== */
@media (min-width: 1024px) {
    .main-content {
        padding: 72px 32px 32px;
    }

    .stats-grid {
        gap: 16px;
    }

    .card-body {
        padding: 20px 24px;
    }

    .stat-number {
        font-size: 24px;
    }
}

/* ========================================
   RESPONSIVE - MOBILE LANDSCAPE
   ======================================== */
@media (max-width: 480px) {
    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-number {
        font-size: 17px;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .card-header,
    .card-body {
        padding-left: 14px;
        padding-right: 14px;
    }

    .page-header {
        margin-bottom: 14px;
    }

    .page-title {
        font-size: 20px;
    }
}

/* ========================================
   GALLERY GRID
   ======================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
    aspect-ratio: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 30px 12px 10px;
    color: #ffffff;
}

.gallery-item-title {
    font-size: 13px;
    font-weight: 600;
}

.gallery-item-date {
    font-size: 11px;
    opacity: 0.8;
}

/* Status badges with colors */
.badge-blue {
    background: rgba(26, 115, 232, 0.12);
    color: #1a5bb5;
}

.badge-purple {
    background: rgba(128, 90, 213, 0.12);
    color: #6d42c7;
}

.badge-orange {
    background: rgba(255, 152, 0, 0.15);
    color: #c77600;
}

/* Action button groups */
.action-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.action-group .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
}

/* Detail card */
.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.detail-value {
    font-size: 14px;
    color: #1f2937;
}

/* Inline form */
.form-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-inline .form-input,
.form-inline .form-select {
    flex: 1;
}

/* Image upload preview */
.upload-preview {
    width: 100%;
    max-height: 200px;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
    background: #f3f4f6;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive gallery */
@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* ========================================
   PRINT
   ======================================== */
@media print {
    .topbar,
    .sidebar,
    .bottom-nav,
    .btn {
        display: none !important;
    }

    .app-container {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        break-inside: avoid;
    }
}


/* ========================================
   PREMIUM RESPONSIVE + GOOGLE DARK/LIGHT MODE
   ======================================== */
:root {
    --rt-bg: #f8fafc;
    --rt-surface: #ffffff;
    --rt-surface-2: #f1f5f9;
    --rt-text: #1f2937;
    --rt-muted: #64748b;
    --rt-border: #e2e8f0;
    --rt-primary: #1a73e8;
    --rt-primary-2: #1557b0;
    --rt-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
    --rt-bg: #202124;
    --rt-surface: #2b2c2f;
    --rt-surface-2: #303134;
    --rt-text: #e8eaed;
    --rt-muted: #bdc1c6;
    --rt-border: #3c4043;
    --rt-primary: #8ab4f8;
    --rt-primary-2: #669df6;
    --rt-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
}

body { background: var(--rt-bg); color: var(--rt-text); }
html[data-theme="dark"] body { background: #202124; color: var(--rt-text); }

.card,
.stat-card,
.login-card,
.modal-content,
.filter-bar,
.empty-state,
.table-wrap,
.upload-preview {
    background: var(--rt-surface);
    border-color: var(--rt-border);
    box-shadow: var(--rt-shadow);
}

.page-title,
.card-title,
.list-item-title,
.stat-number,
.detail-value,
.login-title,
td { color: var(--rt-text); }

.page-subtitle,
.list-item-subtitle,
.list-item-meta,
.stat-label,
.detail-label,
.login-subtitle,
.login-footer,
.login-footer-small { color: var(--rt-muted); }

thead { background: var(--rt-surface-2); }
th { color: var(--rt-muted); border-bottom-color: var(--rt-border); }
td { border-bottom-color: var(--rt-border); }
tr:hover td { background: var(--rt-surface-2); }

.form-input,
.form-select,
.form-textarea,
.search-input {
    background-color: var(--rt-surface);
    border-color: var(--rt-border);
    color: var(--rt-text);
}

.form-input::placeholder,
.form-textarea::placeholder,
.search-input::placeholder { color: var(--rt-muted); }

html[data-theme="dark"] .login-body {
    background: radial-gradient(circle at top, #3c4043 0, #202124 48%, #171717 100%);
}

html[data-theme="dark"] .bottom-nav {
    background: #2b2c2f;
    border-top-color: var(--rt-border);
}

html[data-theme="dark"] .bottom-nav-item { color: var(--rt-muted); }
html[data-theme="dark"] .bottom-nav-active,
html[data-theme="dark"] .bottom-nav-item:hover { color: #8ab4f8; background: rgba(138, 180, 248, 0.12); }

.topbar {
    min-width: 0;
}

.topbar-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    line-height: 1.1;
    color: #fff;
    min-width: 136px;
}

.topbar-clock strong {
    font-size: 14px;
    letter-spacing: 0.3px;
}

.topbar-clock span {
    font-size: 10px;
    opacity: 0.86;
    white-space: nowrap;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.16);
    color: #fff;
    cursor: pointer;
    transition: transform .2s ease, background .2s ease;
}

.theme-toggle:hover { transform: translateY(-1px); background: rgba(255,255,255,0.24); }

.datetime-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(26,115,232,.12), rgba(52,168,83,.10));
    border: 1px solid rgba(26,115,232,.18);
}

.datetime-card .date-text { color: var(--rt-muted); font-size: 13px; }
.datetime-card .time-text { font-size: 24px; font-weight: 800; color: var(--rt-text); letter-spacing: .4px; }

html[data-theme="dark"] .datetime-card {
    background: linear-gradient(135deg, rgba(138,180,248,.16), rgba(129,201,149,.10));
    border-color: rgba(138,180,248,.22);
}

.login-tools {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:18px;
}

.login-clock {
    display:flex;
    flex-direction:column;
    gap:2px;
    font-size:12px;
    color: var(--rt-muted);
}

.login-clock strong { color: var(--rt-text); font-size:16px; }
.login-tools .theme-toggle { background: var(--rt-surface-2); color: var(--rt-text); border: 1px solid var(--rt-border); }

@media (min-width: 768px) {
    .app-container { margin-left: 280px; }
    .topbar { left: 280px; }
    .sidebar { width: 280px; }
}

@media (max-width: 767px) {
    .main-content { width: 100%; padding-left: 12px; padding-right: 12px; }
    .topbar { gap: 8px; padding: 0 10px; }
    .topbar-title { display: none; }
    .topbar-clock { min-width: 112px; align-items: center; }
    .topbar-clock span { display: none; }
    .theme-toggle, .topbar-notif, .mobile-menu-btn { width: 34px; height: 34px; }
    .filter-bar, .filter-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .datetime-card { align-items:flex-start; flex-direction:column; }
    .datetime-card .time-text { font-size: 22px; }
    .table-wrap { margin: 0 -1px; border-radius: 14px; overflow-x: auto; }
    table { min-width: 680px; }
    .action-group, td div[style*="display:flex"] { flex-wrap: nowrap; }
}

@media (max-width: 420px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 82px; }
    .login-card { padding: 24px 18px; }
}

/* Pengaturan Admin */
.settings-form { display: grid; gap: 16px; }
.settings-preview .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(135deg, rgba(26,115,232,.10), rgba(52,168,83,.08));
    border-radius: 18px;
}
.settings-preview-title {
    margin: 10px 0 4px;
    font-size: 24px;
    color: var(--rt-text);
}
.settings-preview p { color: var(--rt-muted); margin: 0; }
.settings-preview-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    font-size: 34px;
    background: var(--rt-surface-2);
    border: 1px solid var(--rt-border);
    box-shadow: var(--rt-shadow);
}
.form-input[readonly] {
    opacity: .76;
    cursor: not-allowed;
    background-image: repeating-linear-gradient(45deg, transparent 0, transparent 8px, rgba(0,0,0,.03) 8px, rgba(0,0,0,.03) 16px);
}
html[data-theme="dark"] .form-input[readonly] {
    background-image: repeating-linear-gradient(45deg, transparent 0, transparent 8px, rgba(255,255,255,.035) 8px, rgba(255,255,255,.035) 16px);
}

@media (max-width: 767px) {
    .settings-preview .card-body { align-items: flex-start; }
    .settings-preview-title { font-size: 20px; }
    .settings-preview-icon { width: 58px; height: 58px; font-size: 28px; }
}

/* Privasi NIK/KTP */
.nik-masked {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: max-content;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    letter-spacing: .06em;
    background: rgba(26, 115, 232, .08);
    border: 1px solid rgba(26, 115, 232, .18);
    color: var(--rt-muted);
    user-select: none;
}
.nik-masked::after {
    content: "🔒";
    letter-spacing: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    opacity: .82;
}
.nik-visible {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    letter-spacing: .04em;
}
input.nik-masked {
    width: 100%;
    max-width: 100%;
    display: block;
}
