:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --sidebar-w: 260px;
  --mail-list-w: 380px;
}

[data-theme="dark"] {
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-light: rgba(56, 189, 248, 0.15);
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --border-color: #334155;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  transition: background-color 0.2s, color 0.2s;
}

/* Card Styling */
.card-custom {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Layout Containers */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-folder-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 4px;
  transition: all 0.15s ease;
}

.sidebar-folder-btn:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.sidebar-folder-btn.active {
  background-color: var(--primary);
  color: #ffffff !important;
  font-weight: 600;
}

/* Mail List Panel */
.mail-list-panel {
  width: var(--mail-list-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.mail-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.mail-item:hover {
  background-color: rgba(2, 132, 199, 0.04);
}

.mail-item.selected {
  background-color: var(--primary-light);
  border-left: 4px solid var(--primary);
}

.mail-item.unread .mail-subject {
  font-weight: 700;
  color: var(--text-main);
}

.mail-item.unread::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--primary);
}

/* Mail Detail View Panel */
.mail-detail-panel {
  flex-grow: 1;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f3f6 25%, #e6eaee 37%, #f0f3f6 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 6px;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 37%, #1e293b 63%);
  background-size: 400% 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* Responsiveness */
@media (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    transition: left 0.3s ease;
  }
  .app-sidebar.show {
    left: 0;
  }
  .mail-list-panel {
    width: 100%;
  }
  .mail-detail-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
  }
  .mail-detail-panel.show {
    display: flex;
  }
}
