/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Navbar Styling */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 15px 50px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e3c72;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-links a {
  text-decoration: none;
  color: #333;
  font-weight: 600;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: #3498db;
}

.btn-login {
  background: #1e3c72;
  color: white !important;
  padding: 10px 25px;
  border-radius: 25px;
  transition: all 0.3s ease;
}

.btn-login:hover {
  background: #3498db;
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(52, 152, 219, 0.3);
}

/* Penyesuaian margin agar tidak tertutup navbar saat di-scroll */
section {
  scroll-margin-top: 100px;
}

/* --- Styling Halaman Login --- */
.login-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-box h2 {
  color: #1e3c72;
  margin-bottom: 20px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  color: #666;
  font-weight: 600;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.3s;
}

.input-group input:focus {
  border-color: #3498db;
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background: #1e3c72;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-submit:hover {
  background: #3498db;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background-color: #f0f4f8;
  color: #333;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 80px 20px;
  text-align: center;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 10px;
}

.hero p {
  font-size: 1.2rem;
  font-weight: 300;
  opacity: 0.9;
}

/* Layout Utama */
main {
  max-width: 1100px;
  margin: -40px auto 40px;
  padding: 0 20px;
}

.section-header {
  text-align: center;
  margin: 60px 0 30px;
}

.section-header h2 {
  color: #1e3c72;
  font-size: 2rem;
}

.section-header p {
  color: #666;
}

/* Grid & Cards */
.sensor-grid,
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.sensor-card,
.profile-card,
.detail-card {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  text-align: center;
  transition: all 0.3s ease;
}

.sensor-card:hover,
.profile-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Ikon & Profil */
.sensor-icon {
  font-size: 3rem;
  color: #3498db;
  margin-bottom: 15px;
}

.avatar {
  width: 80px;
  height: 80px;
  background: #e0e7ff;
  color: #1e3c72;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  margin: 0 auto 15px;
}

.profile-card {
  cursor: pointer;
  border: 2px solid transparent;
}

.profile-card:hover {
  border-color: #3498db;
}

.role {
  color: #e74c3c;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Detail Page Custom */
.detail-card {
  max-width: 600px;
  margin: 80px auto;
}

.btn-back {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 25px;
  background: #1e3c72;
  color: white;
  text-decoration: none;
  border-radius: 25px;
  transition: background 0.3s;
}

.btn-back:hover {
  background: #2a5298;
}

footer {
  text-align: center;
  padding: 20px;
  background: #333;
  color: white;
  margin-top: 50px;
}
/* Styling untuk catatan login */
.login-hint {
  font-size: 0.85rem;
  color: #e74c3c;
  background-color: #fdf0ed;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 20px;
  text-align: left;
  border-left: 4px solid #e74c3c;
}

.login-hint strong {
  color: #c0392b;
}

/* Styling Avatar di Beranda */
.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #1e3c72;
  margin: 0 auto 15px;
  display: block;
}

/* Styling Khusus Halaman Detail Profil */
.profile-header-detail {
  text-align: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.profile-img-large {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #3498db;
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
  margin-bottom: 15px;
}

.role-badge {
  display: inline-block;
  background: #e74c3c;
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 5px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.stat-box {
  background: #f4f7f6;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #1e3c72;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-box i {
  color: #3498db;
}

.profile-body-detail {
  text-align: left;
}

.profile-body-detail h3 {
  color: #1e3c72;
  font-size: 1.2rem;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-body-detail p {
  color: #555;
  line-height: 1.8;
  background: #fcfcfc;
  padding: 15px;
  border-left: 4px solid #3498db;
  border-radius: 0 8px 8px 0;
}
/* Styling Penjelasan Keseluruhan Sistem */
.about-system {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  border-top: 5px solid #1e3c72;
}

.about-system h3 {
  color: #1e3c72;
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.about-system p {
  color: #555;
  line-height: 1.8;
  margin-bottom: 25px;
  font-size: 1.05rem;
}

.system-flow {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.system-flow li {
  background: #f8fafc;
  padding: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-left: 4px solid #3498db;
  transition: transform 0.3s ease;
}

.system-flow li:hover {
  transform: translateX(10px);
  background: #f0f4f8;
}

.system-flow li i {
  font-size: 2rem;
  color: #1e3c72;
  width: 40px;
  text-align: center;
}

.system-flow li strong {
  display: block;
  color: #333;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.system-flow li div {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.6;
}
/* Styling Khusus Halaman Sistem Admin */
.system-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.sys-card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 20px;
  border-left: 5px solid #1e3c72;
}

.sys-icon {
  font-size: 3rem;
  color: #3498db;
  background: #f0f4f8;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.sys-info h4 {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sys-info h2 {
  color: #1e3c72;
  font-size: 2rem;
  margin-bottom: 5px;
}

.sys-info p {
  font-size: 0.85rem;
  color: #888;
}

.chart-container {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  height: 450px; /* Tinggi grafik */
  margin-bottom: 50px;
}

.chart-container h3 {
  color: #1e3c72;
  margin-bottom: 20px;
  font-size: 1.2rem;
}

/* ========================================= */
/* STYLING HALAMAN KOMPONEN YANG LEBIH KEREN */
/* ========================================= */

.component-showcase {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-bottom: 50px;
}

.comp-card {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.comp-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

/* Membuat Layout Zig-Zag */
.comp-card:nth-child(even) {
  flex-direction: row-reverse;
}

.comp-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  border-right: 5px solid;
}

.comp-card:nth-child(even) .comp-visual {
  border-right: none;
  border-left: 5px solid;
}

.comp-visual i {
  font-size: 6rem;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
  transition: transform 0.5s ease;
}

.comp-card:hover .comp-visual i {
  transform: scale(1.1) rotate(5deg);
}

.comp-info {
  flex: 2;
  padding: 40px;
}

.comp-info h3 {
  font-size: 1.8rem;
  color: #1e3c72;
  margin-bottom: 5px;
}

.comp-tagline {
  display: block;
  font-style: italic;
  color: #7f8c8d;
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.comp-info p {
  color: #555;
  line-height: 1.7;
  margin-bottom: 20px;
}

.comp-how-it-works {
  background: #f8fafc;
  padding: 15px 20px;
  border-left: 4px solid #1e3c72;
  border-radius: 0 8px 8px 0;
  margin-bottom: 25px;
  color: #444;
  font-size: 0.95rem;
  line-height: 1.6;
}

.comp-how-it-works strong {
  color: #1e3c72;
}

.comp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.comp-badges .badge {
  background: #ecf0f1;
  color: #2c3e50;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #bdc3c7;
}

/* ========================================= */
/* RESPONSIVE UNTUK HALAMAN KOMPONEN DI HP   */
/* ========================================= */
@media screen and (max-width: 768px) {
  .comp-card,
  .comp-card:nth-child(even) {
    flex-direction: column; /* Ubah ke kolom atas-bawah saat di HP */
  }

  .comp-visual {
    min-height: 200px;
    width: 100%;
    border-right: none !important;
    border-left: none !important;
    border-bottom: 5px solid;
  }

  .comp-info {
    padding: 25px;
  }

  .comp-info h3 {
    font-size: 1.4rem;
  }
}

/* ========================================= */
/* TAMPILAN RESPONSIVE UNTUK HP (MOBILE VIEW)*/
/* ========================================= */
@media screen and (max-width: 768px) {
  /* Menyesuaikan Navbar agar tersusun ke bawah jika layar sempit */
  .navbar {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    text-align: center;
  }

  /* Menyesuaikan kotak status agar menjadi 1 kolom penuh */
  .system-stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Mengubah layout dalam kartu status (Ikon di atas, teks di bawah) */
  .sys-card {
    padding: 20px;
    flex-direction: column;
    text-align: center;
    border-left: none;
    border-top: 5px solid #1e3c72; /* Garis hiasan pindah ke atas */
  }

  /* Mengecilkan ukuran ikon sedikit agar proporsional di HP */
  .sys-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
    margin: 0 auto 10px;
  }

  /* Mengecilkan ukuran font angka/status */
  .sys-info h2 {
    font-size: 1.8rem;
  }

  /* Menyesuaikan tinggi grafik agar tidak kepanjangan saat di-scroll di HP */
  .chart-container {
    height: 300px;
    padding: 15px;
    margin-bottom: 30px;
  }

  .chart-container h3 {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 10px;
  }
}

/* ========================================= */
/* STYLING KHUSUS HALAMAN ADMIN / DATA.PHP   */
/* ========================================= */

body.admin-body {
    background-color: #f4f7fe;
    color: #2b3674;
}

/* Navbar Admin (Spesifik) */
.admin-nav {
    background: #ffffff;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-nav .nav-links a.active {
    color: #4facfe;
}

.admin-nav .btn-logout {
    background: #ffe2e5;
    color: #e74c3c !important;
    padding: 8px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-nav .btn-logout:hover {
    background: #e74c3c;
    color: #fff !important;
}

/* Container Data */
.data-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-header h1 {
    font-size: 2rem;
    color: #2b3674;
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-header p {
    color: #a3aed1;
    font-weight: 500;
    margin-top: 5px;
}

.btn-refresh {
    background: #1e3c72;
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #2a5298;
}

/* Desain Tabel Premium */
.table-wrapper {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
    overflow: hidden;
    overflow-x: auto;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-wrapper thead {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.table-wrapper th {
    padding: 18px 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.table-wrapper td {
    padding: 15px 20px;
    border-bottom: 1px solid #eef2f5;
    color: #444;
    font-size: 0.95rem;
    vertical-align: middle;
}

.table-wrapper tbody tr {
    transition: background 0.2s ease;
}

.table-wrapper tbody tr:hover {
    background-color: #f8fafc;
}

.table-wrapper tbody tr:last-child td {
    border-bottom: none;
}

/* Tipografi Spesifik Tabel */
.td-id { font-weight: 600; color: #a3aed1; }
.td-date { font-weight: 600; }
.td-date i { color: #a3aed1; margin-right: 5px; }
.td-time { font-size: 0.85rem; color: #888; }
.td-time i { color: #a3aed1; margin-right: 5px; }
.td-water-level { font-weight: 600; font-size: 1.1rem; color: #1e3c72; }
.td-water-level span { font-size: 0.8rem; color: #888; }

/* Label/Badge Status */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.badge-danger { background: #ffe2e5; color: #e74c3c; }
.badge-success { background: #e9f7ef; color: #27ae60; }
.badge-warning { background: #fff3e0; color: #f39c12; }
.badge-info { background: #e8f4fd; color: #3498db; }

/* Responsif HP untuk Halaman Data */
@media screen and (max-width: 768px) {
    .page-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .table-wrapper th, .table-wrapper td { padding: 12px 15px; font-size: 0.85rem; }
}
