/* Global Styles */
:root {
  --sidebar-width: 280px;
  --header-height: 60px;
  --primary-color: #3b82f6;
  --bg-color: #f3f4f6;
  --text-color: #1f2937;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden; /* App-like feel */
}

/* Layout */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-color);
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 20;
}

#sidebar.collapsed {
  transform: translateX(-100%);
  margin-right: calc(var(--sidebar-width) * -1);
}

.nav-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  padding: 1rem 1.5rem 0.5rem;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.5rem;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.15s;
  font-size: 0.9rem;
  text-decoration: none;
}

.nav-item:hover {
  background-color: #f9fafb;
}

.nav-item.active {
  background-color: #eff6ff;
  color: var(--primary-color);
  border-right: 3px solid var(--primary-color);
}

/* Main Content */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Header/Toolbar */
#toolbar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
}

/* Preview Area */
#preview-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e5e7eb;
  position: relative;
  overflow: auto;
  padding: 20px;
}

/* Iframe Styling */
.iframe-wrapper {
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

/* PC View: Full width/height of container minus padding */
.mode-pc .iframe-wrapper {
  width: 100%;
  height: 100%;
  max-width: none;
  border: none;
  box-shadow: none;
}

.mode-pc iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Mobile View: Phone frame simulation */
.mode-mobile .iframe-wrapper {
  width: 375px;
  height: 667px; /* iPhone 8 dimensions as baseline */
  border-radius: 40px;
  border: 12px solid #1f2937;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Notch simulation for mobile */
.mode-mobile .iframe-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 24px;
  background: #1f2937;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
}

.mode-mobile iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* Tablet View */
.mode-tablet .iframe-wrapper {
  width: 768px;
  height: 1024px;
  border: 12px solid #1f2937;
  border-radius: 24px;
}
.mode-tablet iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Utilities */
.hidden { display: none !important; }
.btn-icon {
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s;
}
.btn-icon:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

/* Loading Spinner */
.loader {
  border: 3px solid #f3f3f3;
  border-radius: 50%;
  border-top: 3px solid var(--primary-color);
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
