/* Grownode CSS Framework - Modal Styles */
/* All modal, dialog, and overlay styling */

/* Base Modal System */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none !important;
  overflow-y: auto;
}

.modal[style*="display: block"] {
  display: block !important;
}

.modal[style*="display: flex"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  margin: 20px auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-medium);
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.2s ease;
}

.modal.modal-open .modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* Modal Header */
.modal-header {
  padding: 20px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3,
.modal-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-style: italic;
}

.modal-close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #000;
}

/* Modal Body */
.modal-body {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  padding: 20px;
}

/* Modal Footer */
.modal-footer {
  padding: 20px;
  border-top: 1px solid #dee2e6;
  text-align: right;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-footer button {
  padding: 8px 16px;
  border: 1px solid var(--border-color-dark);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

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

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

.modal-footer .btn-primary,
.modal-footer .save-btn {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.modal-footer .btn-primary:hover,
.modal-footer .save-btn:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

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

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

/* Form Sections in Modals */
.form-section {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #f9f9f9;
}

.section-title {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color-dark);
  padding-bottom: 8px;
}

/* Form Elements */
.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 input,
.form-group select,
.form-group textarea {
  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;
}

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

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

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

.form-group.half-width {
  flex: 1;
}

/* Upload Areas */
.upload-section {
  margin-top: 16px;
}

.upload-area {
  width: 100%;
  margin: 10px 0;
}

.upload-dropzone {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #fafafa;
}

.upload-dropzone:hover {
  border-color: var(--primary-color);
  background-color: #f0f8ff;
}

.upload-dropzone.dragover {
  border-color: var(--primary-color);
  background-color: #e3f2fd;
  border-style: solid;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 15px;
  display: block;
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.primary-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.secondary-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.upload-limits {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Upload Progress */
.upload-progress {
  margin-top: 15px;
  width: 100%;
  display: none;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 5px;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* Image Preview */
.current-image {
  margin-bottom: 20px;
}

.image-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.image-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.image-actions button {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-color-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-actions .btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

/* Modal Backdrops and Animations */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop-open {
  opacity: 1;
}

/* Specific Modal Types */
.confirmation-modal .modal-content {
  max-width: 500px;
}

.alert-modal .modal-content {
  max-width: 400px;
}

.form-modal .modal-content {
  max-width: 600px;
}

/* Mobile Modal Styles */
.mobile-modal .modal-content {
  width: 95%;
  margin: 10px auto;
}

.mobile-header {
  padding: 16px;
  background: var(--primary-color);
  color: white;
}

.mobile-header .modal-title {
  color: white;
  font-size: 18px;
}

.mobile-header .modal-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.mobile-header .modal-close {
  color: white;
  font-size: 24px;
}

.mobile-body {
  padding: 16px;
}

.mobile-footer {
  padding: 16px;
  background: #f8f9fa;
}

/* Responsive Modal Design */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10px auto;
    max-height: calc(100vh - 20px);
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .upload-dropzone {
    padding: 30px 15px;
  }
}