/* Teamwork App Styles */

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  z-index: 9999;
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* App Container */
.app {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Screens */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Auth Screen */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-card) 100%);
}

.auth-container {
  text-align: center;
  max-width: 400px;
}

.auth-logo {
  width: 100px;
  height: 100px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary-bg);
  border-radius: 24px;
  color: var(--accent-primary);
}

.auth-container h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-container p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-active);
}

.btn-google {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Main Screen Layout */
.main-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-default);
}

.header h1 {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--error);
  color: white;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-default);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.sidebar.open {
  right: 0;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-default);
}

.sidebar-header .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.sidebar-header .name {
  font-weight: 600;
}

.sidebar-header .email {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.2s;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-primary-bg);
  color: var(--accent-primary);
}

.nav-divider {
  height: 1px;
  background: var(--border-default);
  margin: 1rem 0;
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.5rem 1rem;
}

.nav-item-add {
  border: 1px dashed var(--border-default);
  color: var(--text-muted);
}

.nav-item-add:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-bg);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-top: 1px solid var(--border-default);
}

/* Content */
.content {
  padding: 1rem;
  padding-bottom: 80px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-header);
  border-top: 1px solid var(--border-default);
  padding: 0.5rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
}

.bottom-nav-item:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.bottom-nav-item.active {
  color: var(--accent-primary);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1rem;
}

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

.card-title {
  font-weight: 600;
}

/* Team Card */
.team-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.team-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.team-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-primary-bg);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.25rem;
}

.team-info {
  flex: 1;
}

.team-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.team-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Project Card */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  border-right: 4px solid var(--accent-primary);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.project-name {
  font-weight: 600;
}

.project-progress {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.project-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Task Card */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.task-card:hover {
  border-color: var(--border-hover);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.task-checkbox:hover {
  border-color: var(--accent-primary);
}

.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.task-card.done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
}

/* Tags/Badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tag-priority-low { background: var(--success-bg); color: var(--priority-low); }
.tag-priority-medium { background: var(--info-bg); color: var(--priority-medium); }
.tag-priority-high { background: var(--warning-bg); color: var(--priority-high); }
.tag-priority-urgent { background: var(--error-bg); color: var(--priority-urgent); }

.tag-status-todo { background: var(--bg-hover); color: var(--status-todo); }
.tag-status-in_progress { background: var(--info-bg); color: var(--status-in-progress); }
.tag-status-review { background: var(--accent-secondary-bg); color: var(--status-review); }
.tag-status-done { background: var(--success-bg); color: var(--status-done); }

/* Grid layouts */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 300;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-default);
}

/* Form groups */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 400;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s;
  pointer-events: auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--error); }
.toast-warning { border-color: var(--warning); }
.toast-info { border-color: var(--info); }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Desktop layout */
@media (min-width: 1024px) {
  .main-screen {
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
  }

  .header {
    grid-column: 1 / -1;
  }

  #menu-btn {
    display: none;
  }

  .sidebar {
    position: relative;
    right: auto;
    width: auto;
    border-left: none;
    border-left: 1px solid var(--border-default);
    grid-row: 2;
  }

  .sidebar-overlay {
    display: none;
  }

  .content {
    grid-row: 2;
    padding: 1.5rem 2rem;
    padding-bottom: 2rem;
  }

  .bottom-nav {
    display: none;
  }
}

/* Install prompt */
.install-prompt {
  position: fixed;
  bottom: 80px;
  left: 1rem;
  right: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--accent-primary);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 150;
  box-shadow: var(--shadow-lg);
}

.install-prompt-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-primary-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.install-prompt-content {
  flex: 1;
}

.install-prompt-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.install-prompt-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.install-prompt-actions {
  display: flex;
  gap: 0.5rem;
}

@media (min-width: 1024px) {
  .install-prompt {
    bottom: 1rem;
    left: auto;
    right: 1rem;
    max-width: 400px;
  }
}
