/**
 * GreenCard Modern Components
 * Common UI components for the GreenCard system
 */

/* Modal component */
.gc-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.gc-modal.show {
  opacity: 1;
  visibility: visible;
}

.gc-modal-content {
  background-color: white;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.gc-modal.show .gc-modal-content {
  transform: translateY(0);
}

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

.gc-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gc-neutral-800);
}

.gc-modal-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gc-neutral-600);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.gc-modal-close:hover {
  background-color: var(--gc-neutral-200);
  color: var(--gc-neutral-800);
}

.gc-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

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

/* Toast notifications */
.gc-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gc-toast {
  display: flex;
  align-items: center;
  background-color: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  padding: 1rem;
  min-width: 300px;
  max-width: 450px;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-normal);
  border-left: 4px solid var(--gc-primary);
}

.gc-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.gc-toast-success {
  border-left-color: var(--gc-accent-success);
}

.gc-toast-error {
  border-left-color: var(--gc-accent-danger);
}

.gc-toast-warning {
  border-left-color: var(--gc-accent-warning);
}

.gc-toast-info {
  border-left-color: var(--gc-accent-info);
}

.gc-toast-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
}

.gc-toast-success .gc-toast-icon {
  color: var(--gc-accent-success);
}

.gc-toast-error .gc-toast-icon {
  color: var(--gc-accent-danger);
}

.gc-toast-warning .gc-toast-icon {
  color: var(--gc-accent-warning);
}

.gc-toast-info .gc-toast-icon {
  color: var(--gc-accent-info);
}

.gc-toast-content {
  flex: 1;
  color: var(--gc-neutral-700);
}

.gc-toast-close {
  background: transparent;
  border: none;
  color: var(--gc-neutral-600);
  font-size: 0.875rem;
  cursor: pointer;
  margin-left: 0.75rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.gc-toast-close:hover {
  background-color: var(--gc-neutral-200);
  color: var(--gc-neutral-800);
}

/* Tooltips */
.gc-tooltip {
  position: absolute;
  background-color: var(--gc-neutral-800);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  z-index: 1010;
  max-width: 300px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.gc-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--gc-neutral-800);
}

.gc-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* Breadcrumb navigation */
.gc-breadcrumb-container {
  padding: 0.75rem 1.5rem;
  margin-top: 60px;
  background-color: var(--gc-bg-light);
  border-bottom: 1px solid var(--gc-border-color);
}

.gc-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  list-style: none;
}

.gc-breadcrumb-item {
  display: flex;
  align-items: center;
}

.gc-breadcrumb-item:not(:last-child)::after {
  content: '/';
  margin: 0 0.5rem;
  color: var(--gc-text-muted);
}

.gc-breadcrumb-item a {
  color: var(--gc-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.gc-breadcrumb-item a:hover {
  color: var(--gc-primary-dark);
  text-decoration: underline;
}

.gc-breadcrumb-item.active {
  color: var(--gc-text-muted);
}

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

.gc-dropdown-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.gc-dropdown-toggle::after {
  content: '';
  display: inline-block;
  margin-left: 0.5rem;
  border-top: 0.3rem solid;
  border-right: 0.3rem solid transparent;
  border-bottom: 0;
  border-left: 0.3rem solid transparent;
  vertical-align: middle;
}

.gc-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  display: none;
  min-width: 180px;
  padding: 0.5rem 0;
  margin: 0.25rem 0 0;
  background-color: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gc-neutral-300);
}

.gc-dropdown.show .gc-dropdown-menu {
  display: block;
  animation: dropdown-fade-in 0.2s ease;
}

.gc-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  color: var(--gc-neutral-700);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.gc-dropdown-item:hover {
  background-color: var(--gc-neutral-200);
  color: var(--gc-neutral-800);
}

.gc-dropdown-item i {
  margin-right: 0.75rem;
  width: 16px;
  text-align: center;
  font-size: 0.9rem;
}

.gc-dropdown-divider {
  height: 0;
  margin: 0.5rem 0;
  overflow: hidden;
  border-top: 1px solid var(--gc-neutral-300);
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Botones */
.gc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.gc-btn i {
  margin-right: 0.5rem;
}

.gc-btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

.gc-btn-lg {
  padding: 0.8rem 1.5rem;
  font-size: 1.25rem;
}

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

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

.gc-btn-secondary {
  color: var(--gc-neutral-700);
  background-color: var(--gc-neutral-200);
  border-color: var(--gc-neutral-300);
}

.gc-btn-secondary:hover {
  background-color: var(--gc-neutral-300);
}

.gc-btn-success {
  color: white;
  background-color: var(--gc-accent-success);
  border-color: var(--gc-accent-success);
}

.gc-btn-success:hover {
  background-color: #218838;
  border-color: #1e7e34;
}

.gc-btn-danger {
  color: white;
  background-color: var(--gc-accent-danger);
  border-color: var(--gc-accent-danger);
}

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

.gc-btn-outline-primary {
  color: var(--gc-primary);
  border-color: var(--gc-primary);
  background-color: transparent;
}

.gc-btn-outline-primary:hover {
  color: white;
  background-color: var(--gc-primary);
}

.gc-btn-outline-secondary {
  color: var(--gc-neutral-700);
  border-color: var(--gc-neutral-400);
  background-color: transparent;
}

.gc-btn-outline-secondary:hover {
  color: var(--gc-neutral-800);
  background-color: var(--gc-neutral-200);
}

.gc-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Badges */
.gc-badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 75%;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  border-radius: var(--border-radius-sm);
}

.gc-badge-primary {
  color: white;
  background-color: var(--gc-primary);
}

.gc-badge-secondary {
  color: var(--gc-neutral-800);
  background-color: var(--gc-neutral-300);
}

.gc-badge-success {
  color: white;
  background-color: var(--gc-accent-success);
}

.gc-badge-warning {
  color: var(--gc-neutral-800);
  background-color: var(--gc-accent-warning);
}

.gc-badge-danger {
  color: white;
  background-color: var(--gc-accent-danger);
}

.gc-badge-info {
  color: white;
  background-color: var(--gc-accent-info);
}

/* Cards */
.gc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: var(--gc-neutral-100);
  background-clip: border-box;
  border: 1px solid var(--gc-neutral-300);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.gc-card-header {
  padding: 1rem 1.5rem;
  margin-bottom: 0;
  background-color: var(--gc-neutral-200);
  border-bottom: 1px solid var(--gc-neutral-300);
  border-top-left-radius: var(--border-radius-md);
  border-top-right-radius: var(--border-radius-md);
}

.gc-card-body {
  flex: 1 1 auto;
  padding: 1.5rem;
}

.gc-card-title {
  margin-bottom: 0.75rem;
  color: var(--gc-neutral-800);
}

.gc-card-text {
  color: var(--gc-neutral-700);
}

.gc-card-footer {
  padding: 1rem 1.5rem;
  background-color: var(--gc-neutral-200);
  border-top: 1px solid var(--gc-neutral-300);
  border-bottom-left-radius: var(--border-radius-md);
  border-bottom-right-radius: var(--border-radius-md);
}

.gc-card-img-top {
  width: 100%;
  border-top-left-radius: var(--border-radius-md);
  border-top-right-radius: var(--border-radius-md);
}

.gc-card-img-bottom {
  width: 100%;
  border-bottom-left-radius: var(--border-radius-md);
  border-bottom-right-radius: var(--border-radius-md);
}

.gc-card-icon {
  background: var(--gc-neutral-200);
  color: var(--gc-primary);
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  transition: all var(--transition-normal);
  border-top-left-radius: var(--border-radius-md);
  border-top-right-radius: var(--border-radius-md);
}

.gc-card:hover .gc-card-icon {
  background: var(--gc-primary);
  color: white;
}

/* Cards grid */
.gc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (max-width: 767.98px) {
  .gc-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Alerts */
.gc-alert {
  position: relative;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius-md);
}

.gc-alert-primary {
  color: #004085;
  background-color: #cce5ff;
  border-color: #b8daff;
}

.gc-alert-secondary {
  color: #383d41;
  background-color: #e2e3e5;
  border-color: #d6d8db;
}

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

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

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

.gc-alert-info {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

/* Formularios */
.gc-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.gc-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.gc-form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.gc-form-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--gc-neutral-700);
  font-size: 0.9rem;
}

.gc-form-input,
.gc-form-select,
.gc-form-textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--gc-neutral-400);
  border-radius: var(--border-radius-md);
  font-size: 1rem;
  transition: all var(--transition-fast);
  width: 100%;
  background-color: var(--gc-neutral-100);
}

.gc-form-input:focus,
.gc-form-select:focus,
.gc-form-textarea:focus {
  border-color: var(--gc-primary);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.25);
  outline: none;
}

.gc-form-help {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--gc-neutral-600);
}

.gc-form-check {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.gc-form-check-input {
  margin-right: 0.5rem;
}

.gc-form-check-label {
  margin-bottom: 0;
}

.gc-select-container,
.gc-input-container {
  position: relative;
}

.gc-select-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gc-neutral-600);
  pointer-events: none;
}

.gc-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gc-neutral-600);
}

.gc-input-icon ~ .gc-form-input {
  padding-left: 2.5rem;
}

.gc-input-prefix {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gc-neutral-700);
  font-weight: 500;
}

.gc-input-prefix ~ .gc-form-input {
  padding-left: 3rem;
}

.gc-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 575.98px) {
  .gc-form-actions {
    flex-direction: column;
  }
  
  .gc-btn {
    width: 100%;
  }
}

/* Tablas */
.gc-table {
  width: 100%;
  margin-bottom: 1rem;
  color: var(--gc-neutral-800);
  border-collapse: collapse;
}

.gc-table th,
.gc-table td {
  padding: 1rem;
  vertical-align: top;
  border-top: 1px solid var(--gc-neutral-300);
}

.gc-table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--gc-neutral-300);
  background-color: var(--gc-neutral-200);
  font-weight: 600;
  color: var(--gc-neutral-700);
}

.gc-table tbody tr:hover {
  background-color: var(--gc-neutral-200);
}

.gc-table-bordered {
  border: 1px solid var(--gc-neutral-300);
}

.gc-table-bordered th,
.gc-table-bordered td {
  border: 1px solid var(--gc-neutral-300);
}

.gc-table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

.gc-table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Extras: Spinners, Progress, etc. */
.gc-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 0.25rem solid var(--gc-neutral-300);
  border-right-color: var(--gc-primary);
  border-radius: 50%;
  animation: spinner 0.75s linear infinite;
}

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

.gc-progress {
  display: flex;
  height: 1rem;
  overflow: hidden;
  font-size: 0.75rem;
  background-color: var(--gc-neutral-300);
  border-radius: var(--border-radius-sm);
}

.gc-progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: white;
  text-align: center;
  white-space: nowrap;
  background-color: var(--gc-primary);
  transition: width var(--transition-normal);
}