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

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #111;
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  overflow: visible;
  overscroll-behavior: none;
  min-height: 100vh;
  min-width: 100vw;
}

/* iPhone-Rahmen */
.iphone {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 390px;
  max-height: 844px;
  border-radius: 55px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: visible;
  background: linear-gradient(160deg, #4facfe 0%, #00c6fb 35%, #2575fc 70%, #1a2a6c 100%);
  margin: 0 auto;
}

* {
  box-sizing: border-box;
}

/* Wallpaper-Atmosphäre */
.iphone::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.25), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(0, 0, 40, 0.35), transparent 50%);
  pointer-events: none;
}

/* Statusbar */
.statusbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 30px 0;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  z-index: 1000;
}

.statusbar .icons {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}

.battery {
  display: inline-block;
  width: 24px;
  height: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 3px;
  position: relative;
}

.battery::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 3.5px;
  width: 2px;
  height: 4px;
  border-radius: 0 2px 2px 0;
  background: rgba(255, 255, 255, 0.6);
}

.battery::before {
  content: "";
  position: absolute;
  inset: 1.5px;
  width: 60%;
  background: #fff;
  border-radius: 1.5px;
}

.signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 11px;
}

.signal span {
  width: 3px;
  background: #fff;
  border-radius: 1px;
}

.signal span:nth-child(1) { height: 4px; }
.signal span:nth-child(2) { height: 6px; }
.signal span:nth-child(3) { height: 8px; }
.signal span:nth-child(4) { height: 11px; }

/* Home-Screen-Grid */
.home-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 24px 130px;
  overflow: hidden;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px 22px;
  justify-items: center;
  overflow: hidden;
}

/* App-Icon */
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 74px;
}

.app-icon {
  width: 62px;
  height: 62px;
  border-radius: 15px;
  background: linear-gradient(180deg, #34c759 0%, #30b14e 100%);
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.app-icon:active {
  transform: scale(0.9);
}

/* Chat-Symbol im Icon */
.chat-glyph {
  width: 34px;
  height: 30px;
  position: relative;
}

.chat-glyph .bubble {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 10px 10px 10px 2px;
}

.app-label {
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.1px;
}

/* Tablegram App */
.tablegram-app {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #e5ddd5;
  display: none;
  flex-direction: column;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.tablegram-app.active {
  display: flex;
}

.tablegram-header {
  background: #4b68e8;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 19px;
  font-weight: 600;
  flex-shrink: 0;
}

.tablegram-header .icons {
  display: flex;
  gap: 20px;
  font-size: 20px;
}

.tablegram-search {
  background: #f0f0f0;
  padding: 10px 16px;
  border-bottom: 1px solid #d9d9d9;
  flex-shrink: 0;
}

.tablegram-search input {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 20px;
  background: white;
  font-size: 15px;
  outline: none;
}

.tablegram-chats {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.tablegram-chat-list {
  list-style: none;
  height: 100%;
  overflow: hidden;
}

.tablegram-chat-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #d9d9d9;
  cursor: pointer;
  background: white;
}

.tablegram-chat-item:hover {
  background: #f5f5f5;
}

.tablegram-chat-item.active {
  background: #d4dfff;
}

.tablegram-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #4b68e8;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
}

.tablegram-chat-info {
  flex: 1;
  min-width: 0;
}

.tablegram-chat-name {
  font-size: 17px;
  font-weight: 600;
  color: #000;
  margin-bottom: 2px;
}

.tablegram-chat-preview {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tablegram-chat-time {
  font-size: 12px;
  color: #666;
  text-align: right;
  margin-left: 8px;
}

/* Hide home screen when app is open */
.home-screen.hidden {
  display: none;
}

.statusbar.hidden {
  display: none;
}

.page-dots.hidden {
  display: none;
}

.dock.hidden {
  display: none;
}

.home-indicator.hidden {
  display: none;
}

/* Arthur Chat */
.arthur-chat {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  z-index: 10;
}

.arthur-chat.active {
  display: flex;
}

.arthur-chat-header {
  background: #4b68e8;
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  font-size: 19px;
  font-weight: 600;
  position: relative;
  overflow: visible;
  flex-shrink: 0;
}

.arthur-avatar-header {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 10px;
}

.tablegram-header .back-button,
.arthur-chat-header .back-button {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  margin-right: 12px;
  padding: 4px 8px;
}

.hamburger-menu {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  position: relative;
}

.hamburger-dropdown {
  position: absolute;
  top: 100%;
  right: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 150px;
  display: none;
  z-index: 100;
  overflow: hidden;
}

.hamburger-dropdown.active {
  display: block;
}

.hamburger-item {
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  color: #333;
}

.hamburger-item:hover {
  background: #f5f5f5;
}

.arthur-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 76px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.arthur-chat-message {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.4;
}

.arthur-chat-message.sent {
  background: #4b68e8;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.arthur-chat-input {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #ccc;
  gap: 12px;
  height: 60px !important;
  width: 100%;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  box-sizing: border-box;
}

.arthur-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 20px;
  background: white;
  font-size: 15px;
  outline: none;
  min-height: 40px;
}

.arthur-chat-input button {
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
}

.camera-button {
  font-size: 24px;
  color: #4b68e8;
}

.switch-camera-button {
  font-size: 24px;
  color: #4b68e8;
}

.send-button {
  background: #007AFF;
  color: white;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 15px;
}

/* Chat images */
.chat-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.chat-image:hover {
  transform: scale(1.05);
}

.arthur-chat-message img {
  display: block;
  margin-top: 4px;
}

/* Dock */
.dock {
  position: absolute;
  bottom: 22px;
  left: 12px;
  right: 12px;
  height: 92px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25);
  pointer-events: none;
  z-index: 5;
}

/* Page dots */
.page-dots {
  position: absolute;
  bottom: 128px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.page-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
}

.page-dots span.active {
  background: #fff;
}

/* Home indicator */
.home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
  z-index: 5;
}

/* Responsive adjustments for mobile devices */
@media (max-width: 390px) {
  .iphone {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    max-width: none;
    max-height: none;
  }
}
