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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

.app {
  height: 100vh;
  width: 100vw;
  background-color: #09090b;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background-color: #18181b;
  border-bottom: 1px solid #27272a;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  color: #a78bfa;
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  color: white;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: #7c3aed;
  color: white;
}

.btn-primary:hover {
  background-color: #6d28d9;
}

.btn-secondary {
  background-color: #27272a;
  color: white;
}

.btn-secondary:hover {
  background-color: #3f3f46;
}

.btn-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: #3f3f46;
  color: #d4d4d8;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-icon:hover {
  background-color: #52525b;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-panel {
  flex: 1;
  background-color: #18181b;
}
.preview-container {
  flex: 1;
  height: 100%;
  width: 100%;
  overflow: hidden;
  display: flex;
}
.editor-panel {
  flex: 1;
}

.panel-header {
  background-color: #27272a;
  padding: 8px 16px;
  border-bottom: 1px solid #3f3f46;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 13px;
  font-weight: 500;
  color: #d4d4d8;
}

.panel-content {
  flex: 1;
  overflow: auto;
  background-color: white;
}

#preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background-color: white; 
  display: block;
}

/* Resize Handle */
.resize-handle {
  width: 4px;
  background-color: #27272a;
  cursor: col-resize;
  transition: background-color 0.2s;
}

.resize-handle:hover,
.resize-handle.resizing {
  background-color: #7c3aed;
}

/* File Tabs */
.tabs-container {
  background-color: #27272a;
  border-bottom: 1px solid #3f3f46;
  display: flex;
  align-items: center;
  overflow-x: auto;
}

.tabs {
  display: flex;
  flex: 1;
  overflow-x: auto;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-right: 1px solid #3f3f46;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
  position: relative;
}

.tab:hover {
  background-color: #3f3f46;
}

.tab.active {
  background-color: #18181b;
  color: white;
}

.tab:not(.active) {
  background-color: #27272a;
  color: #a1a1aa;
}

.tab-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tab-icon.html {
  color: #fb923c;
}

.tab-icon.css {
  color: #60a5fa;
}

.tab-icon.js {
  color: #fbbf24;
}

.tab-name {
  font-size: 14px;
  font-weight: 500;
}

.tab-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  color: #a1a1aa;
}

.tab:hover .tab-close {
  display: flex;
}

.tab-close:hover {
  background-color: #3f3f46;
  color: white;
}

.btn-new-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: none;
  border: none;
  color: #a1a1aa;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
  white-space: nowrap;
}

.btn-new-file:hover {
  color: white;
  background-color: #3f3f46;
}

/* Editor Container */
.editor-container {
  flex: 1;
  overflow: hidden;
  background-color: #1e1e1e;
}

/* Dialog */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog {
  background-color: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  padding: 24px;
  width: 400px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.dialog-large {
  width: 500px;
}

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

.dialog-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: white;
}

.dialog-close {
  padding: 4px;
  background: none;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.dialog-close:hover {
  background-color: #27272a;
}

.dialog-content {
  margin-bottom: 24px;
}

.dialog-footer {
  display: flex;
  gap: 8px;
}

.dialog-footer .btn {
  flex: 1;
}

.full-width {
  width: 100%;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #d4d4d8;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 8px 12px;
  background-color: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  color: white;
  font-size: 14px;
}

.form-group input::placeholder {
  color: #71717a;
}

.form-group input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* File Type Buttons */
.file-type-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.file-type-btn {
  padding: 8px 16px;
  background-color: #27272a;
  color: #a1a1aa;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.file-type-btn:hover {
  background-color: #3f3f46;
}

.file-type-btn.active[data-type="html"] {
  background-color: #ea580c;
  color: white;
}

.file-type-btn.active[data-type="css"] {
  background-color: #2563eb;
  color: white;
}

.file-type-btn.active[data-type="js"] {
  background-color: #ca8a04;
  color: white;
}

/* Share Dialog */
.share-description {
  color: #a1a1aa;
  margin-bottom: 24px;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.share-option {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background-color: #27272a;
  border: 2px solid #3f3f46;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.share-option:hover {
  border-color: #52525b;
}

.share-option.active {
  border-color: #7c3aed;
  background-color: rgba(124, 58, 237, 0.1);
}

.share-option-icon {
  padding: 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.share-option.active .share-option-icon {
  background-color: #7c3aed;
}

.share-option:not(.active) .share-option-icon {
  background-color: #3f3f46;
}

.share-option-icon svg {
  color: white;
}

.share-option-text {
  flex: 1;
}

.share-option-text h3 {
  font-size: 15px;
  font-weight: 500;
  color: white;
  margin-bottom: 4px;
}

.share-option-text p {
  font-size: 13px;
  color: #a1a1aa;
}

/* Share URL Dialog */
.share-url-label {
  font-size: 13px;
  color: #a1a1aa;
  margin-bottom: 12px;
}

.share-url-container {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

#share-url-input {
  flex: 1;
  padding: 8px 12px;
  background-color: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  color: white;
  font-size: 13px;
}

.share-info {
  padding: 16px;
  background-color: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 8px;
}

.share-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.share-info-header svg {
  color: #a78bfa;
}

.share-info-header span {
  font-size: 13px;
  font-weight: 500;
  color: white;
}

.share-info p {
  font-size: 13px;
  color: #a1a1aa;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background-color: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  padding: 16px;
  min-width: 300px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast.success .toast-icon {
  color: #22c55e;
}

.toast.error .toast-icon {
  color: #ef4444;
}

.toast.info .toast-icon {
  color: #3b82f6;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 14px;
  font-weight: 500;
  color: white;
  margin-bottom: 4px;
}

.toast-description {
  font-size: 13px;
  color: #a1a1aa;
}

/* CodeMirror Override */
.cm-editor {
  height: 100%;
  outline: none !important;
}

.cm-scroller {
  font-family: 'Fira Code', 'Consolas', monospace !important;
}

/* Ensure the editor container doesn't overflow */
.editor-container {
  display: block;
  position: relative;
}