/* ========================================================= */
/* SPINNER                                                   */
/* ========================================================= */

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #3b3f45;
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================================= */
/* WRAPPER                                                   */
/* ========================================================= */

.ui-wrapper {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 1rem 1.4rem;
}

/* ========================================================= */
/* HEADERS                                                   */
/* ========================================================= */

.ui-header-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.ui-header-sub {
    color: #9aa0a7;
    font-size: 1rem;
    margin-top: 0.25rem;
}

/* ========================================================= */
/* WORKSPACE HEADER                                          */
/* ========================================================= */

.workspace-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.workspace-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
/* ========================================================= */
/* GRID                                                      */
/* ========================================================= */

.ui-grid {
    display: grid;
    gap: 1.4rem;
}

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

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

/* ========================================================= */
/* CARD                                                      */
/* ========================================================= */

.ui-card {
    position: relative;
    padding: 1.3rem;
    background: #1a1b1e;
    border: 1px solid #2a2c31;
    border-radius: .8rem;
    display: block;

    box-shadow: 0 3px 6px rgba(0,0,0,.35);
    transition: transform .15s ease,
                box-shadow .15s ease,
                border-color .15s ease;
}

.ui-card:hover {
    transform: translateY(-4px);
    border-color: #4c78ff;
    box-shadow: 0 8px 20px rgba(0,0,0,.45);
}

/* ========================================================= */
/* BOX                                                       */
/* ========================================================= */

.ui-box {
    padding: 1.6rem;
    background: #1a1b1e;
    border: 1px solid #2a2c31;
    border-radius: .8rem;
    box-shadow: 0 3px 6px rgba(0,0,0,.35);
}

/* ========================================================= */
/* BUTTONS                                                   */
/* ========================================================= */

.ui-btn {
    display: inline-block;
    padding: .55rem 1rem;
    background: #4c78ff;
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

.ui-btn:hover {
    background: #395fe0;
}

.ui-btn-danger {
    background: #b53737;
}

.ui-btn-danger:hover {
    background: #d64545;
}

.ui-btn-small {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.ui-btn-muted {
    background: #2a2c31;
    color: #9aa0a7;
}

.ui-btn-muted:hover {
    background: #3a3c42;
    color: #ffffff;
}


/* ========================================================= */
/* CRUD ACTION BAR                                           */
/* ========================================================= */

.ui-crud-bar {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.6rem;
    margin-bottom: 1.8rem;
}


/* ========================================================= */
/* FLEX UTILITIES                                            */
/* ========================================================= */

.ui-flex {
    display: flex;
}

.ui-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ui-flex-center {
    display: flex;
    align-items: center;
}

.ui-flex-gap-sm {
    gap: 0.6rem;
}

.ui-flex-gap-md {
    gap: 0.8rem;
}

.ui-flex-gap-lg {
    gap: 1rem;
}

.ui-mb-sm {
    margin-bottom: 0.6rem;
}

.ui-mb-md {
    margin-bottom: 0.8rem;
  }

/* ========================================================= */
/* TEXT UTILITIES                                            */
/* ========================================================= */

.ui-truncate {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================= */
/* HEADER LAYOUT                                             */
/* ========================================================= */

.ui-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.ui-header-left {
    min-width: 0;
}

.ui-header-right {
    flex-shrink: 0;
}


/* ========================================================= */
/* PAGE EDITOR                                               */
/* ========================================================= */

.page-editor-form {
  max-width: 100%;
}

.editor-field {
  margin-bottom: 1.2rem;
}

.editor-field label {
  display: block;
  font-size: 0.85rem;
  color: #9aa0a6;
  margin-bottom: 0.4rem;
}

.page-editor-form input[type="text"],
.page-editor-form textarea {
  width: 100%;
  box-sizing: border-box;
}

.editor-content textarea {
  min-height: 65vh;
  background: #0f1115;
  color: #e5e7eb;

  border: 1px solid #2a2c31;
  border-radius: 6px;

  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  line-height: 1.6;

  padding: 1rem;
}

.editor-content textarea:focus {
  outline: none;
  border-color: #6b7280;
}

.editor-meta {
  margin: 1rem 0;
  color: #9aa0a6;
  font-size: 0.85rem;
}

.editor-actions {
  margin-top: 1.5rem;
  text-align: right;
}

.hint {
  font-size: 0.85rem;
  color: #9aa0a6;
  margin-top: 0.5rem;
}
