:root {
  color-scheme: dark;
  background: #090b10;
  color: #e8edf8;
  font-family: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(to top, rgba(0,0,0,0.12), rgba(238,242,245,0)), #eef2f5;
  background-image:
    linear-gradient(to top, rgba(0,0,0,0.12), rgba(238,242,245,0)),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0) 35%),
    radial-gradient(circle at 80% 10%, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 27%);
  background-attachment: fixed;
  background-size: cover;
  color: #1f1f1f;
}

.center-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.logo-box {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1.6rem 1.8rem;
  border: 1px solid #3b3b3b;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, #5a5a5a 0%, #bfc1c5 70%, #f3f5f8 100%);
  box-shadow: 0 28px 60px rgba(0,0,0,0.12), 0 60px 90px rgba(0,0,0,0.08);
  max-width: min(90vw, 760px);
  width: min(100%, 760px);
}

.logo {
  width: 100%;
  max-width: 700px;
  height: auto;
  transform: scale(0.85);
  transform-origin: center center;
  animation: logoGrow 5s ease-in-out forwards;
}

@keyframes logoGrow {
  from {
    transform: scale(0.85);
  }
  to {
    transform: scale(1);
  }
}

.card {
  width: min(90vw, 640px);
  max-width: 640px;
  border-radius: 1.25rem;
  padding: 2rem;
  background: linear-gradient(180deg, #575757 0%, #d0d0d0 75%, #f4f6f9 100%);
  border: 1px solid #3b3b3b;
  box-shadow: 0 28px 65px rgba(0,0,0,0.12), 0 64px 96px rgba(0,0,0,0.08);
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  line-height: 1.1;
  color: #ffffff;
  text-align: center;
}

label {
  display: block;
  font-size: .95rem;
  margin-bottom: .5rem;
}

input {
  width: 100%;
  padding: .95rem 1.1rem;
  margin-bottom: 1rem;
  border-radius: .85rem;
  border: 1px solid rgba(0,0,0,.12);
  background: #ffffff;
  color: #1f1f1f;
}

button {
  width: 100%;
  padding: .95rem 1rem;
  border: none;
  border-radius: .95rem;
  background: linear-gradient(180deg, #3d6dd1 0%, #5a87e2 100%);
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(61,109,209,0.2);
}

button:hover {
  background: #3a6edc;
}

.error {
  color: #ff6b6b;
  min-height: 1.4rem;
}

/* Navbar Styles */
.navbar {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #2a2f3a;
  border-bottom: 1px solid rgba(255,255,255,.08);
  gap: 1rem;
}

.navbar-left {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.hamburger span {
  width: 100%;
  height: 2.5px;
  background: #e8edf8;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: rgba(20, 25, 35, 0.95);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 0.8rem;
  padding: 0.5rem 0;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100;
}

.hamburger-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-item {
  display: block;
  padding: 0.75rem 1rem;
  color: #e8edf8;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

.menu-item:hover {
  background: rgba(255,255,255,.08);
}

.navbar-center {
  flex: 1;
  text-align: center;
  min-width: 80px;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e8edf8;
  letter-spacing: -0.5px;
}

.navbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,.05);
  padding: 0.5rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(255,255,255,.1);
  margin-left: auto;
  flex-shrink: 0;
}

.navbar-right {
  position: relative;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.search-input {
  width: 100px;
  padding: 0.6rem 2rem 0.6rem 0.8rem;
  border-radius: 0.6rem;
  border: none;
  background: rgba(255,255,255,.08);
  color: #e8edf8;
  font-size: 0.9rem;
  margin: 0;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8edf8' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.2em 1.2em;
}

.search-input::placeholder {
  color: rgba(232, 237, 248, 0.5);
}

.search-button {
  width: auto;
  padding: 0.6rem 0.8rem;
  background: none;
  border: none;
  color: #e8edf8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.search-button:hover {
  opacity: 0.7;
}

.navbar-right {
  position: relative;
}

.profile-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #e8edf8;
}

.profile-btn:hover {
  background: rgba(255,255,255,.12);
}

/* Profile Popup */
.profile-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.75rem;
  background: rgba(20, 25, 35, 0.95);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 0.8rem;
  padding: 1rem;
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100;
}

.profile-popup.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.popup-header {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 0.75rem;
}

.popup-header strong {
  color: #e8edf8;
  font-size: 1rem;
}

.popup-content {
  margin-bottom: 1rem;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.85rem;
}

.popup-row span {
  color: rgba(232, 237, 248, 0.6);
}

.popup-row strong {
  color: #cbd4f5;
  font-weight: 600;
}

.popup-logout {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(180deg, #3d6dd1 0%, #5a87e2 100%);
  color: white;
  text-decoration: none;
  text-align: center;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s;
  border: none;
}

.popup-logout:hover {
  opacity: 0.9;
}

.main-grid {
  padding: 1.25rem;
}

.device-list {
  display: grid;
  gap: 1rem;
}

.profile-card {
  padding: 1.4rem;
  border-radius: 1rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  display: grid;
  gap: .9rem;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.profile-header strong {
  font-size: 1rem;
}

.profile-name {
  margin-top: .2rem;
  color: #cbd4f5;
}

.profile-status {
  padding: .5rem 1rem;
  border-radius: .9rem;
  background: rgba(31,111,235,.15);
  color: #dbe8ff;
  font-size: .85rem;
  white-space: nowrap;
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .6rem;
  align-items: center;
  color: #cbd4f5;
}

.profile-row span {
  color: #8b99b8;
}

.profile-actions {
  padding-top: .5rem;
}

#devices {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  align-items: flex-start;
}

.filters {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
}

.filter-field {
  display: grid;
  gap: .4rem;
}

.filter-field label {
  font-size: .85rem;
  color: #8b99b8;
}

.filter-field input {
  width: 100%;
  padding: .8rem 1rem;
  border-radius: .8rem;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  color: #e8edf8;
}

.device-card {
  border-radius: 1rem;
  padding: .8rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
}

.device-card.size-xs {
  width: 100px;
  min-width: 100px;
}

.device-card.size-sm {
  width: 130px;
  min-width: 130px;
}

.device-card.size-md {
  width: 160px;
  min-width: 160px;
}

.device-card.size-lg {
  width: 200px;
  min-width: 200px;
}

.device-card.green {
  border-color: #2ecc71;
  align-items: center;
}

.device-card.red {
  border-color: #ff6b6b;
  align-items: center;
}

.device-icons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 8rem;
  height: 8rem;
}

.device-icons .device-icon,
.device-icons .lock-icon {
  cursor: pointer;
  transition: opacity 0.2s;
}

.device-icons .device-icon {
  width: 8rem;
  height: 8rem;
}

.device-icons .lock-icon {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 4rem;
  height: 4rem;
}

.device-icons .device-icon:hover,
.device-icons .lock-icon:hover {
  opacity: 0.7;
}

.device-icons .disabled-icon {
  opacity: 0.4;
  cursor: not-allowed;
}

.device-card strong {
  font-size: 1rem;
  text-align: center;
}

.device-card span {
  color: #cbd4f5;
}

.device-status {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  background: rgba(255,255,255,.1);
}

.empty,
.error {
  padding: 1rem;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .navbar {
    padding: 0.8rem 1rem;
    gap: 0.8rem;
  }

  .search-input {
    width: 80px;
  }

  .brand {
    font-size: 1.2rem;
  }
}

@media (max-width: 860px) {
  .navbar {
    flex-wrap: wrap;
  }

  .navbar-center {
    order: 0;
    flex: 1 1 auto;
  }

  .navbar-search {
    order: 2;
    width: 100%;
    margin-left: 0;
    margin-top: 0.5rem;
  }

  .navbar-right {
    order: 1;
  }

  .search-input {
    width: 100%;
    flex: 1;
    font-size: 0.85rem;
    padding: 0.5rem 1.5rem 0.5rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0.6rem 0.8rem;
    gap: 0.6rem;
  }

  .navbar-search {
    width: 100%;
  }

  .search-input {
    width: 100%;
    flex: 1;
    padding: 0.4rem 1.5rem 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

  .brand {
    font-size: 1rem;
  }

  .hamburger {
    width: 26px;
    height: 24px;
  }

  .hamburger span {
    height: 2px;
  }

  .profile-btn {
    width: 36px;
    height: 36px;
  }

  .profile-popup {
    min-width: 250px;
    right: -50px;
  }

  .hamburger-menu {
    min-width: 160px;
  }
}
