/* Grownode CSS Framework - Component Styles */
/* Buttons, forms, badges, and other UI components */

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border-color-dark);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  background: white;
  color: var(--text-primary);
  box-sizing: border-box;
}

.btn:hover {
  background: #f8f9fa;
  color: var(--text-primary);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border-color: var(--border-color-dark);
}

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

.btn-danger {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.btn-danger:hover {
  background: #c82333;
  border-color: #c82333;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 3px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 6px;
}

/* Form Elements */
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color-dark);
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
  background: white;
  color: var(--text-primary);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.form-control:disabled {
  background: #f8f9fa;
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-select {
  @extend .form-control;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px 12px;
  padding-right: 32px;
}

.form-textarea {
  @extend .form-control;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Form Layout */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

.form-group .form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row .form-group {
  margin-bottom: 0;
  flex: 1;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: auto;
  margin: 0;
}

.form-check label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

/* Status Badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  display: inline-block;
}

.status-active {
  background: #e8f5e8;
  color: #2e7d32;
}

.status-concluded {
  background: #f3e5f5;
  color: #7b1fa2;
}

.status-inactive {
  background: #f5f5f5;
  color: #757575;
}

/* Access Badges */
.access-badge {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}

.access-public {
  background: #e8f5e8;
  color: #2e7d32;
}

.access-member {
  background: #e3f2fd;
  color: #1565c0;
}

.access-staff {
  background: #fff3e0;
  color: #ef6c00;
}

.access-manager {
  background: #fce4ec;
  color: #c2185b;
}

.access-admin {
  background: #ffebee;
  color: #d32f2f;
}

/* Condition Badges */
.condition-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}

.condition-yes {
  background: #e8f5e8;
  color: #2e7d32;
}

.condition-no {
  background: #ffebee;
  color: #d32f2f;
}

/* Tag Badges */
.tag-badge {
  background: #e3f2fd;
  color: #1565c0;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
  display: inline-block;
  margin: 2px;
}

.tag-badge:hover {
  background: #bbdefb;
  color: #0d47a1;
  text-decoration: none;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-light);
}

.card-header h3,
.card-header h4 {
  margin: 0;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--background-light);
  text-align: right;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  margin-bottom: 16px;
}

.alert-success {
  background: #d1edcc;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-info {
  background: #cce7ff;
  border-color: #b8daff;
  color: #0c5460;
}

.alert-warning {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert-danger {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* Loading States */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Sidebar Components */
.sidebar {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  overflow: hidden;
}

.sidebar-section {
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-header {
  padding: 16px 20px;
  background: var(--background-light);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
}

.sidebar-content {
  padding: 16px 20px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.sidebar-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Navigation Components */
.nav-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.nav-tab {
  padding: 12px 20px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

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

.nav-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Dropdown Components */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: white;
  border: 1px solid var(--border-color-dark);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--border-color-dark);
  border-radius: 4px;
  box-shadow: var(--shadow-medium);
  min-width: 180px;
  z-index: 1000;
  display: none;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background: var(--background-light);
  text-decoration: none;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .btn-sm {
    width: auto;
    margin-bottom: 0;
  }
  
  .nav-tabs {
    flex-wrap: wrap;
  }
  
  .nav-tab {
    flex: 1;
    text-align: center;
    min-width: 100px;
  }
}