:root { --primary-color: #1bc7cf; --primary-hover: #15a8af; --neon-glow: 0 4px 15px rgba(27, 199, 207, 0.4); }
body { background-color: #f8f9fa; font-family: Arial, sans-serif; }
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); border-color: var(--primary-hover); }
.border-primary { border-color: var(--primary-color) !important; }

.password-wrapper { position: relative; width: 100%; }
.password-wrapper input { padding-right: 40px !important; }
.auth-popup-content .password-wrapper { margin-top: 8px; }
.auth-popup-content .password-wrapper input { margin-top: 0; }
.toggle-pw { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #888; font-size: 14px; transition: 0.2s; }
.toggle-pw:hover { color: var(--primary-color); }

.auth-popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: none; justify-content: center; align-items: center; z-index: 2000; }
.auth-popup-content { background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 0 16px rgba(0,0,0,0.2); width: 320px; text-align: center; }
.auth-popup-content h3 { margin-bottom: 12px; color: var(--primary-color); font-size: 18px; margin-top: 0;}
.auth-popup-content input { width: 100%; padding: 10px; margin-top: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;}
.auth-popup-actions { margin-top: 16px; display: flex; justify-content: space-between; }
.auth-popup-actions button { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }
.auth-popup-actions button:first-child { background: var(--primary-color); color: #fff; }
.auth-popup-actions button:last-child { background: #f2f2f2; color: #333; }
.auth-popup-message { margin-top: 12px; font-size: 14px; color: red; }

#login-app { display: flex; justify-content: center; align-items: center; min-height: 100vh; flex-direction: column; padding: 20px;}
.login-card { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 0 12px rgba(0,0,0,0.1); width: 100%; max-width: 360px; }
.login-card h2 { text-align: center; margin-bottom: 20px; color: #333; }
.login-card .form-group { margin-bottom: 12px; }
.login-card .form-group label { display: block; margin-bottom: 4px; font-size: 14px; color: #333; }
.login-card .form-group input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; box-sizing: border-box; }
.login-card .actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px;}
.login-card .actions a { color: var(--primary-color); text-decoration: none; }
.login-card button[type="submit"] { width: 100%; padding: 12px; margin-top: 20px; background: var(--primary-color); border: none; color: #fff; border-radius: 4px; font-size: 16px; cursor: pointer; }
.logo-wrapper { display: flex; justify-content: center; margin-bottom: 16px; }
.logo-circle { width: 100px; height: 100px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 8px rgba(0,0,0,0.1); }

.app-list-container { max-width: 700px; width: 100%; margin-top: 40px; padding: 0 15px; }
.app-card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); border: 1px solid #e9ecef; transition: all 0.3s ease; text-decoration: none; display: flex; align-items: center; gap: 15px; cursor: pointer; }
.app-card:hover { transform: translateY(-5px); box-shadow: var(--neon-glow); border-color: var(--primary-color); }
.app-icon { width: 50px; height: 50px; border-radius: 12px; background: rgba(27, 199, 207, 0.1); color: var(--primary-color); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; transition: all 0.3s ease; }
.app-card:hover .app-icon { background: var(--primary-color); color: #fff; }
.app-info { text-align: left; }
.app-info h6 { margin: 0 0 4px 0; font-weight: bold; color: #333; font-size: 15px; }
.app-info p { margin: 0; font-size: 13px; color: #6c757d; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

#toolbox-container,
#canvas-container {
  display: flex;
  flex-direction: column;
}

.toolbox {
  background: #fff; 
  padding: 15px; 
  border-radius: 8px; 
  border: 1px solid #dee2e6;
  flex-grow: 1;       
  overflow-y: auto;   
  height: 0;          
}

.canvas-board { 
  background: #fff; 
  padding: 15px; 
  border-radius: 8px; 
  border: 2px dashed var(--primary-color); 
  min-height: 500px; 
  display: flex; 
  flex-wrap: wrap; 
  align-content: flex-start; 
  transition: all 0.3s ease; 
  flex-grow: 1;       
}

@media (max-width: 768px) {
  .toolbox {
    height: auto; 
  }
}

.tool-item { background: #e9ecef; padding: 10px; margin-bottom: 10px; border-radius: 4px; cursor: grab; font-weight: bold; border: 1px dashed #adb5bd; transition: all 0.2s; }

.nested-sortable:empty { border: 1px dashed #ced4da; border-radius: 6px; background-color: rgba(0,0,0,0.02); min-height: 80px; display: flex; align-items: center; justify-content: center; }
.nested-sortable:empty::after { content: 'Kéo thả component vào đây...'; display: block; text-align: center; color: #adb5bd; width: 100%; font-style: italic; font-size: 0.9em; pointer-events: none; }

.nested-sortable { min-height: 60px; padding: 5px; background: rgba(0,0,0,0.02); display: flex; flex-wrap: wrap; align-content: flex-start; border-radius: 6px; width: 100%; margin-top: 10px; }

.action-top { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.edit-btn { 
  background: #fff; cursor: pointer; padding: 2px 7px; border-radius: 4px; 
  font-size: 0.78em; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; height: 24px; color: var(--primary-color); border: 1px solid var(--primary-color); 
}
.edit-btn:hover { background: var(--primary-color); color: #fff; }

.delete-btn { 
  background: transparent; border: none; color: #dc3545; cursor: pointer; 
  padding: 2px 4px; font-size: 1.1em; transition: 0.2s; display: inline-flex; 
  align-items: center; justify-content: center; height: 24px;
}
.delete-btn:hover { color: #a71d2a; transform: scale(1.2); }

.action-desktop { display: flex; gap: 4px; align-items: center; }
.action-mobile { display: none; }

.item-badges { display: inline-flex; gap: 4px; align-items: center; }

@container canvasItem (max-width: 280px) {
  .action-desktop { display: none !important; }
  .action-mobile { display: block !important; }
  .type-hint { display: none !important; }
}
@container canvasItem (max-width: 150px) {
  .item-label-text { display: none !important; }
}

.custom-fieldset { min-width: 0; margin: 0; border-radius: 6px; }
.custom-legend { float: none !important; width: auto !important; padding: 0 10px !important; margin-bottom: 0 !important; font-size: inherit; font-weight: inherit; line-height: 1 !important; background: transparent !important; border: none !important; }

#floating-toolbox-btn { position: fixed; top: 50%; left: 0; transform: translateY(-50%); z-index: 1050; border-radius: 0 20px 20px 0; padding: 15px 12px; background-color: var(--primary-color); color: #fff; border: 2px solid rgba(255,255,255,0.2); box-shadow: var(--neon-glow); transition: all 0.3s ease; }
#floating-toolbox-btn:hover { background-color: var(--primary-hover); padding-left: 18px; }
#floating-toolbox-btn { display: none; }
@media (max-width: 768px) { #floating-toolbox-btn { display: block; } }

.layout-transition { transition: all 0.3s ease-in-out; }
.unhide-btn { font-size: 13px; padding: 2px 6px; border-radius: 4px; margin-left: 8px; transition: 0.2s; }
.unhide-btn:hover { opacity: 0.8; }

.form-col { flex: 0 0 auto; max-width: 100%; transition: width 0.3s; box-sizing: border-box; }

@media (max-width: 768px) { 
  .form-col { width: 100% !important; min-width: 100% !important; padding: 0 !important; } 
  .canvas-item { width: calc(100% - 10px) !important; margin-left: 5px !important; margin-right: 5px !important; }
  #toolbox-container { display: none; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; background: white; z-index: 1060; width: 280px; box-shadow: 2px 0 15px rgba(0,0,0,0.2); padding-top: 10px; border-radius: 0 12px 12px 0; }
  #toolbox { border: none; box-shadow: none !important; }
  #codeExportArea .row { flex-direction: column; }
  #codeExportArea .col-md-6 { width: 100%; border-right: none !important; border-bottom: 1px solid #dee2e6; }
}

.custom-btn-effect { transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.custom-btn-effect:hover { filter: brightness(0.9); transform: translateY(-2px); box-shadow: 0 8px 15px rgba(0,0,0,0.15) !important; }
.custom-btn-effect:active { filter: brightness(0.85); transform: translateY(1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important; }

/* Tùy chọn: Nhấn mạnh viền nếu select là dạng dropdown phụ thuộc */
select.dynamic-dependent { border-left: 3px solid #dc3545 !important; }