/**
 * CSS Giao Diện Cổng Làm Việc Trung Tâm - Google Workspace Portal
 * Thiết kế phong cách Google Workspace / Material Design 3 cao cấp
 */

/* 1. KHUNG CHÍNH CỦA WORKSPACE HOMEPAGE */
#view-workspace-home {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: #f8fafd;
  color: #1f1f1f;
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

#view-workspace-home.active {
  display: flex;
  flex-direction: column;
}

/* Thanh điều khiển đọc truyện chỉ xuất hiện khi đã mở ứng dụng. */
#view-workspace-home.active ~ .mobile-touch-bar {
  display: none !important;
}

/* 2. HEADER WORKSPACE CỐ ĐỊNH */
.ws-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e1e3e1;
}

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

.ws-logo-box {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.ws-logo-icon {
  width: 44px;
  height: 44px;
}

.ws-logo-text {
  font-size: 24px;
  font-weight: 500;
  color: #444746;
  letter-spacing: -0.2px;
}

.ws-logo-badge {
  font-size: 13px;
  font-weight: 600;
  color: #0b57d0;
  background: #d3e3fd;
  padding: 2px 8px;
  border-radius: 12px;
}

/* Thanh tìm kiếm trung tâm */
.ws-header-center {
  flex: 1;
  max-width: 480px;
  margin: 0 32px;
}

.ws-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  background: #edf2fc;
  border: 1px solid transparent;
  border-radius: 24px;
  transition: all 0.2s ease;
}

.ws-search-bar:focus-within {
  background: #ffffff;
  border-color: #0b57d0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
}

.ws-search-bar svg {
  color: #444746;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.ws-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: #1f1f1f;
}

.ws-search-bar input::placeholder {
  color: #747775;
}

/* Các nút bên phải header */
.ws-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-icon-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #444746;
  cursor: pointer;
  transition: background 0.15s;
}

.ws-icon-btn:hover {
  background: #f0f4f9;
}

/* Phóng to icon bên trong nút header cho khớp nút 48px */
.ws-icon-btn svg {
  width: 26px;
  height: 26px;
}

.ws-icon-btn.ws-apps-btn svg {
  display: none;
}

.ws-icon-btn.ws-apps-btn::before {
  content: "";
  width: 26px;
  height: 26px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ws-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0bd05a, #1ae8a3);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* 3. NỘI DUNG CHÍNH (MAIN BODY) */
.ws-main-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-content: start;
  align-items: start;
  column-gap: 32px;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1280px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 32px 24px 64px 24px;
}

/* Lời chào đầu trang */
.ws-greeting-banner {
  grid-column: 1 / -1;
  margin-bottom: 28px;
}

.ws-greeting-text {
  font-size: 24px;
  font-weight: 600;
  color: #1f1f1f;
  margin: 0 0 6px 0;
  letter-spacing: -0.3px;
}

.ws-greeting-sub {
  font-size: 14px;
  color: #5e5e5e;
  margin: 0;
}

/* Tiêu đề mục */
.ws-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ws-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #444746;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 4. KHỐI TIẾP TỤC CÔNG VIỆC DỞ (CONTINUE CARD) */
.ws-continue-section {
  grid-column: 1 / -1;
  margin-bottom: 36px;
}

.ws-continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #ffffff;
  border: 1px solid #e1e3e1;
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-continue-card:hover {
  border-color: #c2e7ff;
  box-shadow: 0 4px 14px rgba(11, 87, 208, 0.1);
  transform: translateY(-2px);
}

.ws-continue-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.ws-continue-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ws-continue-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-continue-info {
  flex: 1;
  min-width: 0;
}

.ws-continue-app-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ws-app-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.ws-continue-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f1f1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.ws-continue-subtitle {
  font-size: 13px;
  color: #747775;
}

.ws-continue-right {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: 20px;
}

.ws-progress-box {
  width: 150px;
  text-align: right;
}

.ws-progress-text {
  font-size: 12px;
  color: #5e5e5e;
  margin-bottom: 6px;
}

.ws-progress-bar {
  width: 100%;
  height: 6px;
  background: #edf2fc;
  border-radius: 3px;
  overflow: hidden;
}

.ws-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.ws-btn-resume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 20px;
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: opacity 0.15s, transform 0.15s;
}

.ws-btn-resume:hover {
  opacity: 0.92;
  transform: scale(1.03);
}

/* 5. LƯỚI ỨNG DỤNG (APP LAUNCHER GRID) */
.ws-app-section {
  min-width: 0;
}

.ws-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.ws-app-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #e1e3e1;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-app-card:hover {
  border-color: #0b57d0;
  box-shadow: 0 4px 12px rgba(11, 87, 208, 0.08);
  transform: translateY(-2px);
}

.ws-app-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.ws-app-content {
  flex: 1;
}

.ws-app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ws-app-name {
  font-size: 15px;
  font-weight: 600;
  color: #1f1f1f;
}

.ws-app-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}

.ws-app-desc {
  font-size: 12.5px;
  color: #5e5e5e;
  line-height: 1.45;
}

.ws-app-arrow {
  position: absolute;
  top: 18px;
  right: 14px;
  color: #c4c7c5;
  transition: transform 0.15s, color 0.15s;
}

.ws-app-card:hover .ws-app-arrow {
  color: #0b57d0;
  transform: translateX(3px);
}

/* 6. BẢNG TÀI LIỆU GẦN ĐÂY (RECENT ACTIVITIES) */
.ws-recent-section {
  min-width: 0;
}

.ws-recent-table {
  background: #ffffff;
  border: 1px solid #e1e3e1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.ws-recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  transition: background 0.15s;
}

.ws-recent-row:last-child {
  border-bottom: none;
}

.ws-recent-row:hover {
  background: #f7f9fc;
}

.ws-recent-main {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.ws-recent-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

.ws-recent-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-recent-meta {
  flex: 1;
  min-width: 0;
}

.ws-recent-title {
  font-size: 14px;
  font-weight: 500;
  color: #1f1f1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.ws-recent-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #747775;
}

.ws-recent-app-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #444746;
  text-align: left;
}

.ws-recent-time {
  font-size: 12px;
  color: #747775;
  text-align: right;
}

.ws-recent-actions {
  text-align: right;
}

.ws-btn-open-recent {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid #c2e7ff;
  background: #edf2fc;
  color: #0b57d0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.ws-recent-row:hover .ws-btn-open-recent {
  background: #0b57d0;
  color: #ffffff;
  border-color: #0b57d0;
}

/* Empty State */
.ws-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  background: #ffffff;
  border: 1px dashed #c4c7c5;
  border-radius: 14px;
}

.ws-empty-icon {
  width: 48px;
  height: 48px;
  color: #c4c7c5;
  margin-bottom: 12px;
}

.ws-empty-text {
  font-size: 14px;
  color: #747775;
  line-height: 1.6;
}

/* Footer nằm cuối trang, không che nội dung khi danh sách dài. */
.ws-footer {
  flex-shrink: 0;
  border-top: 1px solid #e1e3e1;
  background: #ffffff;
}

.ws-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px 32px;
  color: #5e5e5e;
  font-size: 13px;
}

.ws-footer-brand {
  color: #444746;
  font-size: 20px;
  font-weight: 500;
  text-decoration: none;
}

.ws-footer-brand span {
  color: #747775;
  font-weight: 400;
}

.ws-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.ws-footer-links button {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.ws-footer-links button:hover {
  color: #0b57d0;
}

.ws-footer a:focus-visible,
.ws-footer button:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 4px;
  border-radius: 4px;
}

.ws-footer-language {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* 7. RESPONSIVE BREAKPOINTS */
@media (max-width: 1000px) {
  .ws-main-body {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
  }
  .ws-greeting-banner,
  .ws-continue-section {
    margin-bottom: 0;
  }
  .ws-logo-badge {
    display: none;
  }
}

@media (max-width: 768px) {
  .ws-header {
    padding: 0 16px;
  }
  .ws-header-center {
    display: none;
  }
  .ws-main-body {
    padding: 20px 16px 48px 16px;
  }
  .ws-continue-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .ws-continue-right {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .ws-progress-box {
    width: auto;
    flex: 1;
    text-align: left;
  }
  .ws-header-right {
    gap: 0;
  }
  .ws-logo-text {
    font-size: 18px;
  }
  .ws-logo-icon {
    width: 32px;
    height: 32px;
  }
  .ws-icon-btn {
    width: 36px;
    height: 40px;
  }
  .ws-footer-inner {
    padding: 20px 16px;
    gap: 12px 24px;
  }
}

@media (max-width: 480px) {
  .ws-header {
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .ws-footer-brand {
    flex-basis: 100%;
  }
}
