/* app/assets/stylesheets/drawable_field.css */
/* Styles for Drawable/Annotatable Image Field */

/* ==========================================
   Form Builder Preview Styles
   ========================================== */


.preview-drawable {
  padding: 10px;
}

.drawable-preview-box {
  border: 2px dashed #ccc;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  background: #fafafa;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   Patient Form Drawable Field Styles
   ========================================== */

.drawable-field-wrapper {
  margin-bottom: 20px;
}

.drawable-field-container {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
}

.drawable-instructions {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: #333;
  margin-bottom: 15px;
  padding: 10px;
  background: #f0f7ff;
  border-radius: 6px;
  border-left: 4px solid #007bff;
}

/* Brush Selector */
.drawable-brush-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.brush-label {
  font-weight: 500;
  color: #495057;
  margin-right: 10px;
  font-size: 14px;
}

.brush-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.brush-btn:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brush-btn.active {
  border-color: #007bff;
  background: #e7f3ff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.15);
}

.brush-btn.active .brush-name {
  font-weight: 600;
  color: #0056b3;
}

.brush-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}

.brush-name {
  color: #333;
  font-size: 13px;
}

/* Canvas Wrapper */
.drawable-canvas-wrapper {
  margin: 0 auto;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.drawable-background-canvas,
.drawable-canvas {
  display: block;
}

.drawable-canvas {
  cursor: crosshair;
}

/* Controls */
.drawable-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
  gap: 10px;
}

/* History Controls (Undo/Redo) */
.drawable-history-controls {
  display: flex;
  gap: 8px;
}

.drawable-undo-btn,
.drawable-redo-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, #6c757d, #5a6268);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(108,117,125,0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.drawable-undo-btn:hover:not(:disabled),
.drawable-redo-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a6268, #495057);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(108,117,125,0.4);
}

.drawable-undo-btn:active:not(:disabled),
.drawable-redo-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(108,117,125,0.3);
}

.drawable-undo-btn:disabled,
.drawable-redo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #adb5bd;
  box-shadow: none;
  transform: none;
}

/* Reset Button */
.drawable-reset-btn {
  padding: 10px 24px;
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(220,53,69,0.3);
}

.drawable-reset-btn:hover {
  background: linear-gradient(135deg, #c82333, #bd2130);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220,53,69,0.4);
}

.drawable-reset-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(220,53,69,0.3);
}

/* Loading State */
.drawable-loading {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
  font-size: 14px;
}

.drawable-loading i {
  font-size: 24px;
  margin-bottom: 10px;
  display: block;
  color: #007bff;
}

/* Error State */
.drawable-error {
  text-align: center;
  padding: 40px 20px;
  color: #dc3545;
  background: #fff5f5;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
}

.drawable-error i {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
}

/* ==========================================
   Form Builder Modal - Brush Configuration
   ========================================== */

.drawable-config .brushes-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.drawable-config .brush-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  transition: box-shadow 0.2s ease;
}

.drawable-config .brush-item:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.drawable-config .brush-item input[type="number"] {
  width: 60px;
  text-align: center;
}

.drawable-config .brush-item input[type="text"] {
  flex: 1;
}

.drawable-config .brush-item input[type="color"] {
  width: 50px;
  height: 36px;
  padding: 2px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  cursor: pointer;
}

.drawable-config .brush-item .btn-danger {
  padding: 6px 12px;
  font-size: 16px;
  line-height: 1;
}

/* ==========================================
   Form Submission View Styles
   ========================================== */

.drawable-field-view {
  margin-bottom: 20px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.drawable-field-label {
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  padding-bottom: 10px;
  border-bottom: 2px solid #007bff;
}

.drawable-composite-image {
  text-align: center;
  margin-bottom: 15px;
}

.drawable-composite-image img {
  max-height: 500px;
  max-width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.drawable-structured-data {
  background: #fff;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.markers-summary {
  margin-bottom: 10px;
}

.markers-summary ul {
  list-style: none;
  padding-left: 0;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.markers-summary li {
  background: #f8f9fa;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #e9ecef;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}

.paths-summary {
  color: #6c757d;
  font-size: 14px;
}

.no-drawable-data {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 30px;
}

/* ==========================================
   Responsive Styles
   ========================================== */

@media (max-width: 992px) {
  .drawable-brush-selector {
    gap: 6px;
  }
  
  .brush-btn {
    padding: 5px 8px;
    font-size: 12px;
  }
  
  .brush-number {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .drawable-brush-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .brush-label {
    text-align: center;
    margin-bottom: 10px;
    margin-right: 0;
  }
  
  .brush-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 15px;
  }
  
  .drawable-canvas-wrapper {
    max-width: 100%;
    overflow-x: auto;
  }
  
  .drawable-controls {
    flex-direction: column-reverse;
    gap: 12px;
  }
  
  .drawable-history-controls {
    width: 100%;
    justify-content: center;
  }
  
  .drawable-undo-btn,
  .drawable-redo-btn {
    flex: 1;
    justify-content: center;
  }
  
  .drawable-reset-btn {
    width: 100%;
  }
  
  .drawable-config .brush-item {
    flex-wrap: wrap;
  }
  
  .drawable-config .brush-item input[type="text"] {
    width: 100%;
    margin-bottom: 8px;
  }
}

@media (max-width: 480px) {
  .drawable-field-container {
    padding: 10px;
  }
  
  .drawable-instructions {
    font-size: 14px;
    padding: 8px;
  }
  
  .brush-btn {
    font-size: 11px;
  }
  
  .brush-name {
    font-size: 12px;
  }
  
  .drawable-undo-btn,
  .drawable-redo-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .drawable-reset-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
  .drawable-brush-selector,
  .drawable-controls {
    display: none !important;
  }
  
  .drawable-canvas-wrapper {
    border: 1px solid #000;
    box-shadow: none;
  }
  
  .drawable-field-view {
    page-break-inside: avoid;
  }
}
