/* =========================================================
   Video Autopilot UI V2
   Phase 1.1 - Dashboard Polish
   ========================================================= */

.ui-v2-authenticated .top {
  display: none !important;
}

/* Keep sidebar on right, but make English UI natural LTR */
#app.ui-v2-shell {
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  direction: rtl;
}

.ui-v2-sidebar,
.ui-v2-main {
  direction: ltr;
}

.ui-v2-sidebar {
  padding: 14px 12px;
  border-radius: 18px;
}

.ui-v2-sidebar-brand {
  padding: 7px 9px 16px;
}

.ui-v2-sidebar-brand strong {
  font-size: 15px;
}

.ui-v2-sidebar-brand span {
  font-size: 10px;
}

.ui-v2-nav button {
  min-height: 42px;
  border-radius: 11px;
}

.ui-v2-nav-icon {
  width: 22px;
  font-size: 15px;
}

.ui-v2-nav-label {
  font-size: 12px;
}

/* Header */
.ui-v2-pagebar {
  min-height: 62px;
  padding: 3px 2px 16px;
  direction: ltr;
}

.ui-v2-pagebar h1 {
  font-size: 23px;
}

.ui-v2-pagebar p {
  direction: ltr;
  text-align: left;
}

.ui-v2-pagebar-actions {
  align-items: center;
  direction: ltr;
}

.ui-v2-pagebar-actions #logout {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  min-height: 39px;
  padding: 9px 13px;
  border-radius: 11px;
  background: #151920 !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  color: #d7dce4 !important;
  font-size: 12px;
  box-shadow: none !important;
}

/* Compact stats */
.ui-v2-stats {
  gap: 11px;
  margin-bottom: 14px;
}

.ui-v2-stat {
  min-height: 88px;
  padding: 15px 17px;
  border-radius: 15px;
}

.ui-v2-stat-label {
  font-size: 11px;
}

.ui-v2-stat-value {
  margin-top: 11px;
  font-size: 26px;
}

/* Recent content layout */
.ui-v2-dashboard-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 14px;
}

.ui-v2-dashboard-card {
  padding: 17px;
  border-radius: 16px;
}

.ui-v2-dashboard-card h2 {
  font-size: 15px;
  margin-bottom: 3px;
}

.ui-v2-dashboard-card > p {
  margin-bottom: 14px;
  font-size: 11px;
}

/* Recent list */
.ui-v2-recent-list {
  display: grid;
  gap: 8px;
}

.ui-v2-recent-item {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 62px;
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 12px;
  background: #151920;
  cursor: pointer;
  transition: .16s ease;
}

.ui-v2-recent-item:hover {
  background: #1a1f27;
  border-color: rgba(244,197,66,.25);
  transform: translateY(-1px);
}

.ui-v2-recent-thumb {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background:
    linear-gradient(
      145deg,
      rgba(244,197,66,.15),
      rgba(255,255,255,.025)
    );
  color: #f4c542;
  font-size: 16px;
  font-weight: 800;
}

.ui-v2-recent-content {
  min-width: 0;
}

.ui-v2-recent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f0f3f7;
  font-size: 12px;
  font-weight: 750;
}

.ui-v2-recent-meta {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #747e8e;
  font-size: 10px;
}

.ui-v2-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.035);
  color: #aeb6c2;
  font-size: 9px;
  font-weight: 800;
  text-transform: capitalize;
}

.ui-v2-status-badge.rendered,
.ui-v2-status-badge.ready,
.ui-v2-status-badge.published {
  color: #72dda0;
  background: rgba(63,190,113,.08);
  border-color: rgba(63,190,113,.16);
}

.ui-v2-status-badge.rendering,
.ui-v2-status-badge.generating,
.ui-v2-status-badge.queued {
  color: #f4c542;
  background: rgba(244,197,66,.075);
  border-color: rgba(244,197,66,.16);
}

.ui-v2-status-badge.failed {
  color: #ff8585;
  background: rgba(255,107,107,.075);
  border-color: rgba(255,107,107,.16);
}

.ui-v2-empty {
  padding: 25px 14px;
  border: 1px dashed rgba(255,255,255,.09);
  border-radius: 12px;
  color: #6f7886;
  text-align: center;
  font-size: 11px;
}

.ui-v2-view-all {
  margin-top: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: transparent;
  color: #9da6b4;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.ui-v2-view-all:hover {
  color: #fff;
  background: rgba(255,255,255,.035);
}

/* Existing form pages keep their own RTL content */
.ui-v2-legacy-views {
  direction: rtl;
}

.ui-v2-legacy-views > section {
  text-align: right;
}

/* Desktop width */
@media (min-width: 1300px) {
  .wrap {
    max-width: 1500px !important;
  }
}

/* Tablet / mobile */
@media (max-width: 980px) {
  #app.ui-v2-shell {
    grid-template-columns: 1fr;
    direction: ltr;
  }

  .ui-v2-sidebar {
    order: 0;
  }

  .ui-v2-main {
    order: 1;
  }

  .ui-v2-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .ui-v2-pagebar {
    gap: 11px;
  }

  .ui-v2-pagebar-actions {
    width: 100%;
  }

  .ui-v2-pagebar-actions .ui-v2-action,
  .ui-v2-pagebar-actions #logout {
    flex: 1;
  }

  .ui-v2-stats {
    gap: 8px;
  }

  .ui-v2-stat {
    min-height: 82px;
    padding: 13px;
  }

  .ui-v2-stat-value {
    font-size: 23px;
  }

  .ui-v2-recent-item {
    grid-template-columns: 38px minmax(0,1fr);
  }

  .ui-v2-recent-thumb {
    width: 38px;
    height: 38px;
  }

  .ui-v2-status-badge {
    grid-column: 2;
    justify-self: start;
  }
}
