/* Dashboard Page - c0 Baseline (styled + clean DOM + full a11y) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

/* Visually hidden for screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: #1e293b;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid #334155;
}

.app-logo {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover {
  background: #334155;
  color: #e2e8f0;
}

.nav-item:focus {
  outline: 2px solid #6366f1;
  outline-offset: -2px;
}

.nav-item.active {
  background: #6366f1;
  color: #ffffff;
}

.nav-icon {
  display: flex;
  align-items: center;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid #334155;
}

.btn-compose {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #6366f1;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-compose:hover {
  background: #4f46e5;
}

.btn-compose:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.search-container {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 8px 12px;
  width: 400px;
}

.search-container:focus-within {
  box-shadow: 0 0 0 2px #6366f1;
}

.search-icon {
  color: #64748b;
  display: flex;
  align-items: center;
  margin-right: 8px;
}

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

.search-input::placeholder {
  color: #94a3b8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  position: relative;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-icon:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  margin-left: 8px;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Email Toolbar */
.email-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-container input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #6366f1;
}

.checkbox-container input:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.btn-toolbar {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.btn-toolbar:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-toolbar:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.email-count {
  color: #64748b;
  font-size: 13px;
  margin-right: 8px;
}

/* Email List */
.email-list {
  flex: 1;
  overflow-y: auto;
  background: #ffffff;
}

.email-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
}

.email-item:hover {
  background: #f8fafc;
}

.email-item:focus-within {
  background: #f1f5f9;
}

.email-item.unread {
  background: #f1f5f9;
}

.email-item.unread .email-sender,
.email-item.unread .email-subject {
  font-weight: 600;
}

.email-item .checkbox-container {
  margin-right: 12px;
}

.btn-star {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  margin-right: 16px;
}

.btn-star:hover {
  color: #fbbf24;
}

.btn-star:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.btn-star.starred {
  color: #fbbf24;
}

.email-sender {
  width: 160px;
  font-size: 14px;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.email-content {
  flex: 1;
  display: flex;
  min-width: 0;
  margin: 0 16px;
}

.email-subject {
  color: #1e293b;
  font-size: 14px;
  white-space: nowrap;
}

.email-preview {
  color: #64748b;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.email-attachment {
  color: #64748b;
  display: flex;
  align-items: center;
}

.email-time {
  color: #64748b;
  font-size: 13px;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
  
  .search-container {
    width: 100%;
    max-width: 400px;
  }
  
  .email-sender {
    width: 100px;
  }
}

