/* Organization Portal Styles */

/* Common */
.tcr-org-signup,
.tcr-org-login,
.tcr-org-dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #047857;
  color: #fff;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  background: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: #059669;
  color: #059669;
}

.btn-large {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
}

/* Form Styles */
.form-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.form-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: #1f2937;
}

.section-desc {
  color: #6b7280;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.forgot-password-link {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: #059669;
  text-decoration: none;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.form-actions {
  margin-top: 24px;
}

.form-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.form-message.success {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}

.form-message.error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* Signup Page */
.tcr-org-signup {
  max-width: 700px;
}

.signup-header,
.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.signup-header h2,
.login-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  color: #1f2937;
}

.signup-header p,
.login-header p {
  color: #6b7280;
}

.signup-form,
.login-form {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 32px;
}

.signup-footer,
.login-footer {
  text-align: center;
  margin-top: 24px;
  color: #6b7280;
}

.signup-footer a,
.login-footer a {
  color: #059669;
  font-weight: 500;
}

/* Module Selection */
.modules-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.module-option:hover {
  border-color: #059669;
}

.module-option.selected,
.module-option:has(input:checked) {
  border-color: #059669;
  background: #ecfdf5;
}

.module-option input {
  width: 20px;
  height: 20px;
  accent-color: #059669;
}

.module-info {
  flex: 1;
}

.module-info strong {
  display: block;
  font-size: 15px;
  color: #1f2937;
  margin-bottom: 2px;
}

.module-info span {
  font-size: 13px;
  color: #6b7280;
}

.module-badge {
  padding: 4px 10px;
  background: #dbeafe;
  color: #2563eb;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.module-badge.included {
  background: #dcfce7;
  color: #16a34a;
}

/* Login Page */
.tcr-org-login {
  max-width: 400px;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.dashboard-header h1 {
  margin: 0;
  font-size: 28px;
  color: #1f2937;
}

.dashboard-header p {
  margin: 4px 0 0 0;
  color: #6b7280;
}

/* Tabs */
.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #059669;
}

.tab-btn.active {
  color: #059669;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #059669;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.tab-header h2 {
  margin: 0;
  font-size: 20px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  color: #059669;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: #6b7280;
}

/* Quick Actions */
.quick-actions h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: #1f2937;
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.action-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}

.action-card h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #1f2937;
}

.action-card p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #6b7280;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.data-table th {
  background: #f9fafb;
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  color: #1f2937;
}

.data-table tr:hover td {
  background: #f9fafb;
}

.data-table .loading {
  text-align: center;
  color: #6b7280;
  padding: 40px;
}

.data-table code {
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}

.project-card h4 {
  margin: 0 0 8px 0;
}

.project-card .project-meta {
  font-size: 13px;
  color: #6b7280;
}

/* Settings */
.settings-form {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
}

.settings-form h2 {
  margin: 0 0 24px 0;
}

.settings-form h3 {
  margin: 24px 0 16px 0;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.modules-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modules-settings label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  cursor: pointer;
}

.modules-settings input {
  width: 18px;
  height: 18px;
  accent-color: #059669;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-content form,
.modal-content > div:not(.modal-header) {
  padding: 20px;
}

.key-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #92400e;
  font-size: 14px;
}

.key-display {
  background: #f9fafb;
  border-radius: 8px;
  padding: 16px;
}

.key-field {
  margin-bottom: 12px;
}

.key-field:last-child {
  margin-bottom: 0;
}

.key-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.key-field code {
  display: block;
  background: #1f2937;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  word-break: break-all;
}

/* API Docs */
.api-docs h2 {
  margin: 0 0 16px 0;
}

.api-docs h3 {
  margin: 32px 0 16px 0;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.api-info-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

.api-info-box code {
  background: #1f2937;
  color: #e5e7eb;
  padding: 6px 12px;
  border-radius: 4px;
  margin-left: 8px;
}

.api-docs .endpoint {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.api-docs .endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.api-docs .endpoint p {
  margin: 0;
  padding: 0 16px 14px;
  color: #6b7280;
  font-size: 14px;
}

.api-docs .method {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.api-docs .method.get {
  background: #dbeafe;
  color: #2563eb;
}

.api-docs .method.post {
  background: #dcfce7;
  color: #16a34a;
}

.api-docs .method.put {
  background: #fef3c7;
  color: #92400e;
}

.api-docs .endpoint-header code {
  font-weight: 600;
  font-size: 14px;
}

.api-docs .endpoint-params {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.api-docs .endpoint-params table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.api-docs .endpoint-params td {
  padding: 6px 0;
  font-size: 13px;
}

.api-docs .endpoint-params td:first-child {
  width: 120px;
}

.api-docs .code-block {
  background: #1f2937;
  color: #e5e7eb;
  padding: 16px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre;
}

.api-docs .response-codes {
  width: 100%;
  border-collapse: collapse;
}

.api-docs .response-codes td {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
}

.api-docs .response-codes td:first-child {
  width: 60px;
  font-family: monospace;
  font-weight: 600;
  text-align: center;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: #059669;
  color: #fff;
  border-color: #059669;
}

/* Password Reset Pages */
.tcr-forgot-password,
.tcr-reset-password {
  max-width: 400px;
  margin: 0 auto;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tcr-auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.tcr-auth-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  color: #1f2937;
}

.tcr-auth-header p {
  color: #6b7280;
  margin: 0;
}

.tcr-auth-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 32px;
}

.tcr-auth-form .tcr-form-group {
  margin-bottom: 16px;
}

.tcr-auth-form .tcr-form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.tcr-auth-form .tcr-form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.tcr-auth-form .tcr-form-group input:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.tcr-btn-primary {
  display: inline-block;
  width: 100%;
  padding: 12px 24px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tcr-btn-primary:hover {
  background: #047857;
  color: #fff;
}

.tcr-message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.tcr-message.tcr-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.tcr-message.tcr-success {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}

.tcr-auth-footer {
  text-align: center;
  margin-top: 24px;
  color: #6b7280;
}

.tcr-auth-link {
  color: #059669;
  font-weight: 500;
  text-decoration: none;
}

.tcr-auth-link:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .dashboard-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .tcr-forgot-password,
  .tcr-reset-password {
    padding: 16px;
  }

  .tcr-auth-box {
    padding: 24px;
  }
}
