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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #fff;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.screen {
  animation: fadeIn 0.3s ease;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login Screen */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 10px;
}

.logo h1 {
  font-size: 2.5rem;
  color: #00d4aa;
  margin-bottom: 5px;
}

.logo p {
  color: #888;
  font-size: 1.1rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 300px;
}

#login-form input {
  padding: 15px 20px;
  border: 2px solid #333;
  border-radius: 10px;
  background: #1a1a2e;
  color: #fff;
  font-size: 1rem;
  text-align: center;
}

#login-form input:focus {
  outline: none;
  border-color: #00d4aa;
}

#login-form button {
  padding: 15px 30px;
  background: linear-gradient(135deg, #00d4aa 0%, #00a896 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#login-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 212, 170, 0.4);
}

.error {
  color: #ff6b6b;
  text-align: center;
  font-size: 0.9rem;
}

/* Upload Screen */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #333;
  margin-bottom: 30px;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #00d4aa;
}

.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: #00d4aa;
  color: #00d4aa;
}

/* Storage Bar */
.storage-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 200px;
  max-width: 300px;
}

.storage-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #888;
}

#storage-text {
  color: #00d4aa;
}

#storage-files {
  color: #666;
}

.storage-progress {
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
}

.storage-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4aa, #00a896);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

.storage-fill.warning {
  background: linear-gradient(90deg, #ffc107, #ff9800);
}

.storage-fill.danger {
  background: linear-gradient(90deg, #ff6b6b, #dc3545);
}

/* Folder Section */
.folder-section {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.folder-section label {
  color: #888;
  padding-top: 12px;
}

.folder-input-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 250px;
}

.folder-input-wrapper input {
  padding: 10px 15px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  width: 100%;
}

.folder-input-wrapper input:focus {
  outline: none;
  border-color: #00d4aa;
}

.folder-hint {
  font-size: 0.75rem;
  color: #666;
  margin-top: 5px;
}

/* Drop Zone */
.drop-zone {
  border: 3px dashed #333;
  border-radius: 15px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 30px;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: #00d4aa;
  background: rgba(0, 212, 170, 0.05);
}

.drop-zone-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.drop-zone p {
  font-size: 1.2rem;
  color: #888;
}

.drop-zone .hint {
  font-size: 0.9rem;
  color: #555;
  margin-top: 5px;
}

.drop-zone .webp-notice {
  font-size: 0.8rem;
  color: #00d4aa;
  margin-top: 10px;
  padding: 5px 12px;
  background: rgba(0, 212, 170, 0.1);
  border-radius: 20px;
  display: inline-block;
}

#file-input {
  display: none;
}

/* Progress */
#upload-progress {
  margin-bottom: 30px;
}

.progress-bar {
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4aa, #00a896);
  width: 0%;
  transition: width 0.3s;
}

.progress-text {
  text-align: center;
  color: #888;
  margin-top: 10px;
  font-size: 0.9rem;
}

/* Results */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.results-header h2,
#recent-section h2 {
  font-size: 1.2rem;
  color: #00d4aa;
}

#results-list,
#recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #1a1a2e;
  border-radius: 10px;
  border: 1px solid #333;
}

.file-item.error {
  border-color: #ff6b6b;
}

.file-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  background: #333;
}

.file-info {
  flex: 1;
  overflow: hidden;
}

.file-name {
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-url {
  font-size: 0.8rem;
  color: #00d4aa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-error {
  color: #ff6b6b;
  font-size: 0.85rem;
}

.file-actions {
  display: flex;
  gap: 8px;
}

.btn-copy {
  padding: 8px 16px;
  background: #00d4aa;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: #00a896;
}

.btn-copy.copied {
  background: #28a745;
}

.btn-delete {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid #ff6b6b;
  border-radius: 6px;
  color: #ff6b6b;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: #ff6b6b;
  color: #fff;
}

/* Recent Section */
#recent-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #333;
}

#recent-section h2 {
  margin-bottom: 15px;
}

#refresh-btn {
  margin-bottom: 15px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #28a745;
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  animation: slideUp 0.3s ease;
  z-index: 1000;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* File Browser */
#browser-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #333;
}

#browser-section h2 {
  font-size: 1.2rem;
  color: #00d4aa;
  margin-bottom: 15px;
}

.browser-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  gap: 15px;
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.breadcrumb-item {
  color: #888;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.breadcrumb-item:hover {
  background: rgba(0, 212, 170, 0.1);
  color: #00d4aa;
}

.breadcrumb-item.active {
  color: #00d4aa;
  font-weight: 500;
}

.breadcrumb-separator {
  color: #555;
  font-size: 0.8rem;
}

.browser-content {
  display: flex;
  gap: 20px;
  min-height: 400px;
}

.browser-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1a1a2e;
  border-radius: 10px;
  border: 1px solid #333;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 15px;
  background: rgba(0, 212, 170, 0.1);
  color: #00d4aa;
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 1px solid #333;
}

#folder-tree {
  padding: 10px;
  max-height: 350px;
  overflow-y: auto;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: #ccc;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.folder-item:hover {
  background: rgba(0, 212, 170, 0.1);
  color: #00d4aa;
}

.folder-item.active {
  background: rgba(0, 212, 170, 0.15);
  color: #00d4aa;
}

.folder-item .folder-icon {
  font-size: 1rem;
}

.folder-item .folder-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: #666;
  background: #2a2a3e;
  padding: 2px 6px;
  border-radius: 10px;
}

.browser-main {
  flex: 1;
  min-width: 0;
}

.browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

.browser-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #666;
  padding: 40px;
}

.browser-empty {
  text-align: center;
  color: #666;
  padding: 60px 20px;
}

.browser-empty span {
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
}

.browser-card {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s;
}

.browser-card:hover {
  border-color: #00d4aa;
  transform: translateY(-2px);
}

.browser-card-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #2a2a3e;
  display: block;
}

.browser-card-info {
  padding: 10px;
}

.browser-card-name {
  font-size: 0.8rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.browser-card-actions {
  display: flex;
  gap: 6px;
}

.browser-card-actions button {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.browser-card .btn-copy {
  background: #00d4aa;
  border: none;
  color: #fff;
}

.browser-card .btn-copy:hover {
  background: #00a896;
}

.browser-card .btn-delete {
  background: transparent;
  border: 1px solid #ff6b6b;
  color: #ff6b6b;
  padding: 5px 8px;
}

.browser-card .btn-delete:hover {
  background: #ff6b6b;
  color: #fff;
}

.subfolder-card {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.subfolder-card:hover {
  border-color: #00d4aa;
  background: rgba(0, 212, 170, 0.05);
}

.subfolder-card .folder-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.subfolder-card .folder-name {
  font-size: 0.85rem;
  color: #ccc;
}

/* Responsive */
@media (max-width: 768px) {
  .browser-content {
    flex-direction: column;
  }

  .browser-sidebar {
    width: 100%;
  }

  #folder-tree {
    max-height: 150px;
  }

  .browser-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 600px) {
  .file-item {
    flex-wrap: wrap;
  }

  .file-actions {
    width: 100%;
    margin-top: 10px;
  }

  .folder-section {
    flex-direction: column;
    align-items: stretch;
  }

  .browser-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 25px;
  border-bottom: 1px solid #333;
  padding-bottom: 0;
}

.tab-btn {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #888;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: #00d4aa;
  background: rgba(0, 212, 170, 0.05);
}

.tab-btn.active {
  color: #00d4aa;
  border-bottom-color: #00d4aa;
  font-weight: 500;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ============================================
   HTML COMPILER
   ============================================ */
.compiler-container {
  max-width: 1000px;
  margin: 0 auto;
}

.compiler-header {
  margin-bottom: 20px;
}

.compiler-header h2 {
  font-size: 1.4rem;
  color: #00d4aa;
  margin-bottom: 8px;
}

.compiler-desc {
  color: #888;
  font-size: 0.9rem;
}

/* Editor Toolbar */
/* Primary color variable for future Tailwind integration */
:root {
  --primary-color: #00d4aa;
  --primary-hover: #00b894;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 15px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  align-items: center;
}

.editor-toolbar select,
.editor-toolbar button {
  padding: 8px 12px;
  background: #2a2a3e;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-toolbar select:hover,
.editor-toolbar button:hover {
  background: #3a3a4e;
  border-color: var(--primary-color);
}

.editor-toolbar select:focus,
.editor-toolbar button:focus {
  outline: none;
  border-color: var(--primary-color);
}

.editor-toolbar .ql-active {
  background: var(--primary-color) !important;
  color: #0d0d1a !important;
}

.editor-toolbar .ql-highlight {
  background: rgba(0, 212, 170, 0.15);
  border-color: var(--primary-color);
}

.editor-toolbar .ql-highlight.ql-active {
  background: var(--primary-color) !important;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: #444;
  margin: 0 3px;
}

.editor-toolbar .ql-header {
  min-width: 90px;
}

.editor-toolbar .ql-align {
  min-width: 110px;
}

/* Quill Editor Container */
#editor-container {
  background: #fff;
  border: 1px solid #333;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

#rich-editor {
  min-height: 400px;
  font-size: 16px;
  color: #333;
  padding: 20px;
  outline: none;
  background: #fff;
  border-radius: 0 0 10px 10px;
}

#rich-editor:empty:before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}

#rich-editor p {
  margin-bottom: 10px;
}

#rich-editor h1, #rich-editor h2, #rich-editor h3, #rich-editor h4 {
  margin: 15px 0 10px 0;
  font-weight: 600;
}

#rich-editor h1 { font-size: 2em; }
#rich-editor h2 { font-size: 1.5em; }
#rich-editor h3 { font-size: 1.17em; }
#rich-editor h4 { font-size: 1em; }

/* Tables inside editor */
#rich-editor table {
  border-collapse: collapse;
  width: 100%;
  margin: 15px 0;
  background: #fff;
}

#rich-editor table td,
#rich-editor table th {
  border: 1px solid #000;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 60px;
}

#rich-editor table tr:first-child td {
  background: #f0f0f0;
  font-weight: 600;
}

#rich-editor table td:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

#rich-editor blockquote {
  border-left: 4px solid var(--primary-color);
  margin: 10px 0;
  padding-left: 15px;
  color: #666;
}

#rich-editor pre {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
}

#rich-editor a {
  color: var(--primary-color);
}

#rich-editor ul, #rich-editor ol {
  margin: 10px 0;
  padding-left: 30px;
}

#rich-editor img {
  max-width: 100%;
  height: auto;
}

/* Action Buttons */
.compiler-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 12px 24px;
  background: linear-gradient(135deg, #00d4aa 0%, #00a896 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 212, 170, 0.3);
}

/* HTML Preview Modal */
#html-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

#html-preview-modal .preview-content {
  background: #1a1a2e;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(0, 212, 170, 0.1);
  border-bottom: 1px solid #333;
  border-radius: 12px 12px 0 0;
}

.preview-header h3 {
  font-size: 1.1rem;
  color: #00d4aa;
  margin: 0;
}

.preview-header .close-btn {
  background: transparent;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.preview-header .close-btn:hover {
  color: #ff6b6b;
}

.preview-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

#html-output {
  padding: 20px;
  margin: 0;
  min-height: 200px;
  max-height: 60vh;
  overflow: auto;
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #b8b8b8;
  white-space: pre-wrap;
  word-break: break-all;
  background: #0d0d1a;
  line-height: 1.5;
}

.preview-footer {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid #333;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-radius: 0 0 12px 12px;
}

.preview-footer button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.preview-footer .btn-copy {
  background: #00d4aa;
  color: #0d0d1a;
  border: none;
  font-weight: 600;
}

.preview-footer .btn-copy:hover {
  background: #00b894;
}

.preview-footer .btn-close {
  background: transparent;
  color: #888;
  border: 1px solid #444;
}

.preview-footer .btn-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* ============================================
   EMBED CODE MODAL
   ============================================ */
#embed-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

#embed-modal.hidden {
  display: none;
}

.embed-content {
  background: #1a1a2e;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
}

.embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(0, 212, 170, 0.1);
  border-bottom: 1px solid #333;
  border-radius: 12px 12px 0 0;
}

.embed-header h3 {
  font-size: 1.1rem;
  color: var(--primary-color);
  margin: 0;
}

.embed-header .close-btn {
  background: transparent;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.embed-header .close-btn:hover {
  color: #ff6b6b;
}

.embed-body {
  padding: 20px;
}

.embed-hint {
  color: #888;
  font-size: 0.9rem;
  margin: 0 0 12px 0;
}

#embed-code-input {
  width: 100%;
  min-height: 150px;
  padding: 15px;
  background: #0d0d1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
}

#embed-code-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

#embed-code-input::placeholder {
  color: #555;
}

.embed-footer {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid #333;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-radius: 0 0 12px 12px;
}

.embed-footer button {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.embed-footer .btn-insert {
  background: var(--primary-color);
  color: #0d0d1a;
  border: none;
  font-weight: 600;
}

.embed-footer .btn-insert:hover {
  background: var(--primary-hover);
}

.embed-footer .btn-cancel {
  background: transparent;
  color: #888;
  border: 1px solid #444;
}

.embed-footer .btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* ============================================
   TABLE MODAL
   ============================================ */
#table-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 20px;
}

.table-modal-content {
  background: #1a1a2e;
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
}

.table-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(0, 212, 170, 0.1);
  border-bottom: 1px solid #333;
}

.table-modal-header h3 {
  color: var(--primary-color);
  font-size: 1.3rem;
  margin: 0;
}

.table-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 160px);
}

.table-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.table-size-section h4,
.table-actions-section h4,
.table-preview-section h4 {
  color: #888;
  font-size: 0.85rem;
  text-transform: uppercase;
  margin: 0 0 12px 0;
  letter-spacing: 0.5px;
}

.size-inputs {
  display: flex;
  gap: 15px;
}

.size-inputs label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #ccc;
  font-size: 0.9rem;
}

.size-inputs input {
  width: 80px;
  padding: 10px 12px;
  background: #2a2a3e;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 1rem;
  text-align: center;
}

.size-inputs input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.table-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.table-action-btn {
  padding: 8px 12px;
  background: #2a2a3e;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.table-action-btn:hover {
  background: #3a3a4e;
  border-color: var(--primary-color);
}

.table-action-btn.danger {
  color: #ff6b6b;
}

.table-action-btn.danger:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: #ff6b6b;
}

#table-preview-container {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  overflow-x: auto;
}

#table-preview {
  width: 100%;
  border-collapse: collapse;
  color: #333;
}

#table-preview td {
  border: 1px solid #ddd;
  padding: 10px 12px;
  min-width: 80px;
  text-align: left;
  vertical-align: top;
}

#table-preview td:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

#table-preview tr:first-child td {
  background: #f5f5f5;
  font-weight: 600;
}

.table-modal-footer {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid #333;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.table-modal-footer button {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.table-modal-footer .btn-insert {
  background: var(--primary-color);
  color: #0d0d1a;
  border: none;
  font-weight: 600;
}

.table-modal-footer .btn-insert:hover {
  background: var(--primary-hover);
}

.table-modal-footer .btn-cancel {
  background: transparent;
  color: #888;
  border: 1px solid #444;
}

.table-modal-footer .btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

@media (max-width: 600px) {
  .table-options {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   IMAGE PICKER MODAL
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #16213e;
  border-radius: 15px;
  width: 100%;
  max-width: 900px;
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid #333;
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(0, 212, 170, 0.1);
  border-bottom: 1px solid #333;
}

.modal-header h3 {
  font-size: 1.1rem;
  color: #00d4aa;
}

.modal-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
}

.modal-close:hover {
  color: #ff6b6b;
}

.modal-body {
  padding: 20px;
  max-height: calc(80vh - 70px);
  overflow-y: auto;
}

.picker-toolbar {
  margin-bottom: 15px;
}

.picker-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.picker-card {
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.picker-card:hover {
  border-color: #00d4aa;
  transform: translateY(-3px);
}

.picker-card-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  background: #2a2a3e;
}

.picker-card-name {
  padding: 8px;
  font-size: 0.75rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.picker-folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.picker-folder .folder-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.picker-folder .folder-name {
  font-size: 0.8rem;
  color: #ccc;
}

/* Responsive Modal */
@media (max-width: 600px) {
  .modal-content {
    max-height: 90vh;
  }

  .picker-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .editor-toolbar {
    padding: 8px;
  }

  .editor-toolbar select,
  .editor-toolbar button {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  .toolbar-separator {
    display: none;
  }
}