/* Medication Page Styles */
@import '../themes/variables.css';

/* Override/extend medical page shared styles for medication-specific styling */
.medication-container {
  min-height: 100vh;
  background-color: var(--color-bg-secondary, #f8f9fa);
  font-family: var(
    --font-family-sans,
    'Segoe UI',
    Tahoma,
    Geneva,
    Verdana,
    sans-serif
  );
}

.medication-header {
  background: linear-gradient(
    135deg,
    var(--color-primary, #667eea) 0%,
    var(--color-primary-dark, #764ba2) 100%
  );
  color: var(--color-text-light, white);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-md, 0 2px 10px rgba(0, 0, 0, 0.1));
}

.medication-header h1 {
  margin: 0;
  font-size: 1.8rem;
  flex: 1;
}

.back-button {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text-light, white);
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md, 5px);
  cursor: pointer;
  transition: var(--transition-all, all 0.3s ease);
  font-weight: 500;
  text-decoration: none;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.medication-content {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.error-message {
  background: var(--color-error-bg, #f8d7da);
  color: var(--color-error-text, #721c24);
  padding: 1rem;
  border-radius: var(--border-radius-md, 5px);
  margin-bottom: 1rem;
  border: 1px solid var(--color-error-border, #f5c6cb);
}

.success-message {
  background: var(--color-success-bg, #d4edda);
  color: var(--color-success-text, #155724);
  padding: 1rem;
  border-radius: var(--border-radius-md, 5px);
  margin-bottom: 1rem;
  border: 1px solid var(--color-success-border, #c3e6cb);
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
  color: var(--color-text-primary, #333);
}

.spinner {
  border: 4px solid var(--color-bg-tertiary, #f3f3f3);
  border-top: 4px solid var(--color-primary, #667eea);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Controls */
.medication-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.controls-left .add-button {
  background: linear-gradient(
    135deg,
    var(--color-success, #28a745) 0%,
    var(--color-success-light, #20c997) 100%
  );
  color: var(--color-text-light, white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-lg, 8px);
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: var(--transition-all, all 0.3s ease);
  box-shadow: var(--shadow-success, 0 2px 10px rgba(40, 167, 69, 0.3));
}

.controls-left .add-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-success-hover, 0 4px 15px rgba(40, 167, 69, 0.4));
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-controls label {
  font-weight: 500;
  color: var(--color-text-primary, #333);
}

.sort-controls select {
  padding: 0.5rem;
  border: 2px solid var(--color-border, #e9ecef);
  border-radius: var(--border-radius-md, 5px);
  background: var(--color-bg-primary, white);
  color: var(--color-text-primary, #333);
  cursor: pointer;
}

.sort-order-button {
  background: var(--color-neutral, #6c757d);
  color: var(--color-text-light, white);
  border: none;
  padding: 0.5rem;
  border-radius: var(--border-radius-md, 5px);
  cursor: pointer;
  font-size: 1rem;
  min-width: 35px;
}

.sort-order-button:hover {
  background: #5a6268;
}

/* Form Modal */
.medication-form-overlay {
  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: 1000;
  padding: 1rem;
}

.medication-form-modal {
  background: white;
  border-radius: 10px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 10px 10px 0 0;
}

.form-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.3rem;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-button:hover {
  background: #e9ecef;
  color: #333;
}

.medication-form-modal form {
  padding: 1.5rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem;
  border: 2px solid #e9ecef;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}

.cancel-button {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.cancel-button:hover {
  background: #5a6268;
}

.save-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.save-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Medications List */
.medications-list {
  margin-top: 2rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6c757d;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin: 0 0 1rem 0;
  color: #495057;
}

.medications-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.medication-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.medication-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.medication-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.medication-name {
  margin: 0;
  font-size: 1.2rem;
  color: #333;
  font-weight: 600;
  flex: 1;
}

/* Status badge styles moved to components/medical/StatusBadge.css */

/* Status colors moved to components/medical/StatusBadge.css */

.medication-details {
  margin-bottom: 1.5rem;
}

.detail-item {
  display: flex;
  margin-bottom: 0.5rem;
  align-items: flex-start;
}

.detail-item .label {
  font-weight: 600;
  color: #495057;
  min-width: 100px;
  margin-right: 0.5rem;
}

.detail-item .value {
  color: #333;
  flex: 1;
  word-break: break-word;
}

.medication-actions {
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid #e9ecef;
  padding-top: 1rem;
}

.edit-button {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  flex: 1;
}

.edit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(255, 193, 7, 0.3);
}

.delete-button {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  flex: 1;
}

.delete-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(220, 53, 69, 0.3);
}

/* Responsive Design */

