/**
 * TASKMATE - Admin Styles
 * ========================
 * Styles fuer die Admin-Oberflaeche
 */

/* Admin Screen */
.admin-screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-main);
}

.admin-screen.active {
  display: flex;
}

/* Admin Header */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.admin-header h1 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-header h1 svg {
  width: 24px;
  height: 24px;
  stroke: var(--primary);
}

/* Admin Content */
.admin-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Users Section */
.admin-users-section {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

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

.admin-users-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
}

/* User List */
.admin-users-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-user-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  gap: 1rem;
  transition: all var(--transition-fast);
}

.admin-user-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.admin-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
  position: relative;
}

.admin-user-initials {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-user-info {
  flex: 1;
  min-width: 0;
}

.admin-user-name {
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.admin-user-username {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.admin-user-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.admin-badge.role-admin {
  background: var(--error-bg);
  color: var(--error-text);
}

.admin-badge.role-user {
  background: var(--primary-light);
  color: var(--primary);
}

.admin-badge.permission {
  background: var(--success-bg);
  color: var(--success-text);
}

.admin-user-actions {
  display: flex;
  gap: 0.5rem;
}

.admin-user-actions button {
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.admin-user-actions button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.admin-user-actions button.danger:hover {
  background: var(--error);
  border-color: var(--error);
  color: var(--text-inverse);
}

/* User Modal - Verwendet Standard-Formularstyles aus components.css */
.user-modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-5);
}

.user-modal-form .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  margin-bottom: 0;
}

.user-modal-form label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

.user-modal-form label span {
  font-weight: normal;
  color: var(--text-tertiary);
}

.user-modal-form .form-hint {
  margin-top: 4px;
}

/* Input-Felder im User Modal - nutzen Standard-Styles, aber mit sichtbarem Hintergrund */
.user-modal-form input[type="text"],
.user-modal-form input[type="password"],
.user-modal-form select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-primary);
  transition: all var(--transition-fast);
}

.user-modal-form input[type="text"]:hover,
.user-modal-form input[type="password"]:hover,
.user-modal-form select:hover {
  border-color: var(--border-dark);
}

.user-modal-form input[type="text"]:focus,
.user-modal-form input[type="password"]:focus,
.user-modal-form select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.user-modal-form input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.user-modal-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 40px;
}

.permissions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: var(--spacing-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.permission-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-2);
}

.permission-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.permission-item label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: var(--font-medium);
}

.permission-item .permission-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-left: auto;
}

/* User Status */
.admin-user-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.status-locked {
  color: var(--color-priority-high);
}

.status-active {
  color: var(--color-priority-low);
}

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

.admin-empty-state svg {
  width: 48px;
  height: 48px;
  fill: var(--text-muted);
  margin-bottom: 1rem;
}

/* Input with Prefix */
.input-with-prefix {
  display: flex;
  align-items: stretch;
}

.input-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-sm);
}

.input-with-prefix input {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0 !important;
  flex: 1;
}

/* Form Hint */
.form-hint {
  font-weight: normal;
  font-size: var(--text-xs);
  color: var(--text-muted);
}


/* =========================
   Upload Settings Section
   ========================= */

.admin-upload-section {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
  margin-top: 1.5rem;
  padding: 1.5rem;
}

.admin-section-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.admin-section-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-section-header h2 svg {
  stroke: var(--primary);
}

/* Upload Size Input */
.admin-upload-size {
  margin-bottom: 1.5rem;
}

.admin-upload-size label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.upload-size-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 150px;
}

.upload-size-input input {
  width: 80px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-primary);
}

.upload-size-input input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.upload-size-unit {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

/* =========================
   Extension Settings (New)
   ========================= */

.admin-upload-extensions {
  margin-bottom: 1.5rem;
}

.admin-upload-extensions h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin: 0 0 1rem 0;
}

/* Extension Tags Container */
.extension-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  min-height: 50px;
  margin-bottom: 1rem;
}

.extension-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

/* Single Extension Tag */
.extension-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 10px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: var(--font-mono, monospace);
}

.extension-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.extension-tag-remove:hover {
  background: rgba(255, 255, 255, 0.4);
}

.extension-tag-remove svg {
  stroke: white;
}

/* Add Extension Group */
.extension-add-group {
  margin-bottom: 1rem;
}

.extension-add-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.extension-input-row {
  display: flex;
  gap: 0.5rem;
  max-width: 400px;
}

.extension-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-mono, monospace);
}

.extension-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.extension-input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-primary);
}

/* Suggestions */
.extension-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.extension-suggestions-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  margin-right: 0.5rem;
}

.extension-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.extension-suggestion {
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.extension-suggestion:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.extension-no-suggestions {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

/* Upload Actions */
.admin-upload-actions {
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

/* Responsive */
/* Passwort-Input Gruppe */
.password-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.password-input-group input {
  flex: 1;
}

.password-input-group .btn {
  padding: 0.5rem;
  min-width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-input-group .btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .admin-header {
    padding: 1rem;
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-user-card {
    flex-wrap: wrap;
  }

  .admin-user-badges {
    width: 100%;
    order: 3;
    margin-top: 0.5rem;
  }

  .user-modal-form .form-row {
    grid-template-columns: 1fr;
  }
}
