﻿/* =====================================================
   Sistem Informasi & Asisten Sekretariat KPP Tulungagung â€“ Main Application CSS
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --sidebar-width: 280px;
  --topbar-height: 70px;
  --primary: #003366;
  --primary-light: #004080;
  --primary-dark: #002244;
  --accent: #FF8C00;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-hover: #1e293b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --radius: 24px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  overflow-x: hidden;
}

/* ---- Custom Modern Scrollbar (3D Effect) ---- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.5);
  border-radius: 10px;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
  border-radius: 10px;
  box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.2),
    inset -2px -2px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #64748b 0%, #334155 100%);
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
  box-shadow: none;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-mark {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-main {
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-user {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

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

.user-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.user-role {
  font-size: 12px;
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.nav-section {
  padding: 0 24px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  margin: 4px 16px;
  border-radius: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 100%);
  color: #fff;
  border-left: 3px solid var(--primary-light);
  border-radius: 0 12px 12px 0;
  margin-left: 0;
  padding-left: 37px;
  /* 24px original padding + 16px margin - 3px border */
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.nav-item:hover svg {
  transform: scale(1.1);
}

/* ---- Main Layout ---- */
.main-layout {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.topbar {
  height: var(--topbar-height);
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 900;
}

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

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
}

.breadcrumb {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

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

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f1f5f9;
  padding: 8px 16px;
  border-radius: 10px;
  width: 300px;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  width: 100%;
}

.notif-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--error, #ef4444);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 10px;
  border: 2px solid #fff;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: #fecaca;
}

/* ---- Content Area ---- */
.content-area {
  padding: 30px;
}

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

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Dashboard Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--glass-border);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: floatSimple 6s ease-in-out infinite;
  animation-delay: calc(var(--delay, 0) * 0.1s);
}

.stat-card:hover {
  transform: translateY(-10px) rotateX(5deg) rotateY(2deg);
  box-shadow: var(--shadow-lg);
  background: #fff;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-info h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 4px;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--glass-border);
  transition: all 0.4s ease;
}

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

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
}

/* ---- Sharelink Form ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
}

.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Activity Feed ---- */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.activity-item {
  display: flex;
  gap: 12px;
}

.activity-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary-light);
  margin-top: 4px;
  flex-shrink: 0;
}

.activity-content {
  font-size: 14px;
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

/* ---- Calendar ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 10px;
}

.cal-day-head {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-bottom: 8px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: #f8fafc;
}

.cal-day:hover {
  background: var(--primary-light);
  color: #fff;
}

.cal-day.has-event {
  color: var(--primary);
  font-weight: 800;
}

.event-dot {
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  position: absolute;
  bottom: 6px;
}

.cal-day:hover .event-dot {
  background: #fff;
}

.cal-day-empty {
  aspect-ratio: 1;
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* =====================================================
   NATIVE APP MOBILE STYLES - Bottom Nav, Touch, PWA
   ===================================================== */

/* Bottom Navigation Bar */
.bottom-nav {
  display: none;
}

/* Sidebar Close Button */
.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 999;
}
.sidebar-overlay.open {
  display: block;
}

/* TABLET (max 1024px) */
@media (max-width: 1024px) {
  .search-bar { width: 220px; }
  .content-area { padding: 20px; }
}

/* MOBILE & TABLET DRAWER MODE (max 768px) */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 300px;
    box-shadow: 20px 0 60px rgba(0,0,0,0.3);
    z-index: 1001;
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }

  .main-layout {
    margin-left: 0 !important;
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    padding: 0 16px;
    height: 60px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }

  .hamburger { display: flex; padding: 10px; margin-left: -10px; }
  .search-bar { display: none; }
  .topbar-right { gap: 10px; }
  .logout-btn span { display: none; }
  .logout-btn { padding: 8px; min-width: 38px; border-radius: 10px; }
  .breadcrumb { font-size: 15px; font-weight: 700; }

  /* Bottom Navigation */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.08);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    align-items: stretch;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 8px 4px;
    transition: color 0.2s ease, transform 0.15s ease;
    position: relative;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item svg { width: 22px; height: 22px; transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1); }
  .bottom-nav-item span { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }

  .bottom-nav-item.active { color: var(--primary); }
  .bottom-nav-item.active svg { transform: translateY(-3px) scale(1.15); }
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
  }
  .bottom-nav-item:active { transform: scale(0.93); }

  /* Content */
  .content-area { padding: 16px 14px 24px; }

  .stats-grid { grid-template-columns: repeat(2,1fr) !important; gap: 12px; }

  .stat-card {
    padding: 14px;
    flex-direction: column;
    text-align: center;
    gap: 10px;
    border-radius: 16px;
    -webkit-tap-highlight-color: transparent;
  }
  .stat-card:active { transform: scale(0.96); }

  .stat-icon { width: 44px; height: 44px; border-radius: 12px; }
  .stat-value { font-size: 20px; font-weight: 800; }
  .page-title { font-size: 20px; font-weight: 800; }
  .page-subtitle { font-size: 13px; }
  .card { border-radius: 18px; padding: 16px; }
  .dashboard-main-grid { grid-template-columns: 1fr !important; gap: 16px; }

  .form-input, input, select, textarea {
    font-size: 16px !important;
    border-radius: 12px;
    padding: 12px 14px;
  }

  button { -webkit-tap-highlight-color: transparent; }
  .btn-primary { padding: 12px 20px; border-radius: 12px; font-size: 14px; min-height: 44px; }

  .nav-item { padding: 14px 20px; min-height: 52px; font-size: 15px; }
}

/* SMALL PHONES (max 480px) */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2,1fr) !important; gap: 10px; }
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 18px; }
  .content-area { padding: 12px 12px 24px; }
}

/* TABLET LANDSCAPE (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(3,1fr); }
  .sidebar { width: 240px; }
}

/* PWA STANDALONE MODE */
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(60px + env(safe-area-inset-top, 0px));
  }
}

/* TOUCH DEVICE OPTIMIZATIONS */
@media (hover: none) and (pointer: coarse) {
  .nav-item { min-height: 48px; }
  .notif-btn, .logout-btn, .hamburger { min-width: 44px; min-height: 44px; }
  .stat-card:hover { transform: none; }
  .nav-item:hover { transform: none; }
  .content-area, .sidebar-nav { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
}