:root {
    --tool-primary: #4a69bd; /* Primary Blue */
    --tool-accent: #1abc9c; /* Accent Green */
    --tool-bg: #f4f7f9; /* Light Background */
    --tool-card: #ffffff; /* Card Background */
    --tool-text: #2c3e50; /* Dark Text */
    --tool-text-light: #7f8c8d; /* Light Grey Text */
    --tool-border: #e9ecef; /* Border Color */
    --tool-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* System Font Stack */
  }
  
  /* Main container for the entire suite */
  .image-suite-container {
    font-family: var(--tool-font);
    background-color: var(--tool-bg);
    padding: 2rem 1rem;
    /* Use flex to center its content */
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    box-sizing: border-box; /* Include padding in height calculation */
  }
  
  /* Wrapper for the control panel and workspace */
  .image-suite-wrapper {
    max-width: 1600px; /* Max width for the whole app */
    width: 100%;
    height: 85vh; /* Use viewport height for a more immersive feel */
    display: grid;
    grid-template-columns: 400px 1fr; /* Controls on left, workspace on right */
    gap: 2rem; /* Gap between panels */
  }
  
  /* Styling for individual panels */
  .tool-panel {
    background: var(--tool-card);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.07); /* Soft shadow */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box; /* Include padding in height */
  }
  
  /* Control group sections */
  .control-group {
    margin-bottom: 1.5rem;
  }
  
  .control-group h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--tool-text);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--tool-border);
  }
  
  /* Sub-groups within control sections */
  .sub-group {
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--tool-border);
    border-radius: 8px;
  }
  
  /* Input field styling */
  input[type=number], input[type=text], select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--tool-border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--tool-text);
    background-color: var(--tool-bg); /* Slightly different background for inputs */
  }
  
  /* Primary button styling */
  .btn-primary {
    width: 100%;
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.8rem;
    border-radius: 8px;
    background: var(--tool-primary);
    cursor: pointer;
    transition: background 0.2s ease;
  }
  
  .btn-primary:hover {
    background: #3a57a0; /* Darker shade on hover */
  }
  
  .btn-primary:disabled {
    background: #bdc3c7; /* Greyed out when disabled */
    cursor: not-allowed;
  }
  
  /* General button styling for adjustments */
  .btn {
    background-color: var(--tool-bg);
    border: 1px solid var(--tool-border);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--tool-text);
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }
  
  .btn:hover {
    background-color: #e0e4e8;
    border-color: #d1d5db;
  }
  
  /* Upload prompt area */
  #upload-prompt {
    text-align: center;
    flex-grow: 1; /* Allow it to take available space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  #upload-area {
    border: 2px dashed var(--tool-border);
    border-radius: 8px;
    cursor: pointer;
    padding: 2rem 1rem;
    text-align: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    width: 100%; /* Make upload area fill its container */
    box-sizing: border-box; /* Include padding in width */
  }
  
  #upload-area.dragover {
    border-color: var(--tool-primary);
    background-color: #f0f3ff;
  }
  
  #upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--tool-text-light);
    margin-bottom: 0.5rem;
  }
  
  #upload-area p {
    color: var(--tool-text-light);
    font-size: 1rem;
    margin: 0;
  }
  
  #file-input-v6 {
    display: none; /* Hide native file input */
  }
  
  /* Radio group styling */
  .radio-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .radio-group label {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid var(--tool-border);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 0.85rem;
    color: var(--tool-text);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }
  
  .radio-group input {
    display: none;
  }
  
  .radio-group input:checked + label {
    background: var(--tool-primary);
    color: white;
    border-color: var(--tool-primary);
  }
  
  /* Position grid for watermark */
  .position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
  }
  
  .position-grid label {
    height: 35px;
    border: 1px solid var(--tool-border);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; /* Add color transition */
  }
  
  .position-grid input {
    display: none;
  }
  
  .position-grid input:checked + label {
    background-color: var(--tool-primary);
    border-color: var(--tool-primary);
    color: white; /* This will make the SVG fill white via currentColor */
  }
  
  /* Specific for controls panel to enable scrolling */
  .controls-panel {
    overflow-y: auto; /* Allow vertical scrolling */
  }
  
  /* Workspace panel for canvas preview */
  .workspace-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* Ensure content doesn't spill out */
  }
  
  /* Canvas container for styling background and centering */
  #canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem; /* Padding around the canvas */
    background-color: #e8eef3; /* Default background for container */
    border-radius: 8px;
    overflow: hidden; /* Hide overflow if canvas is larger than container */
    position: relative; /* For checkerboard overlay */
  }
  
  /* Checkerboard background for transparent areas */
  .checkerboard {
    background-color: #ccc; /* Light grey */
    background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
                      linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
    background-size: 20px 20px; /* Size of each square */
    background-position: 0 0, 10px 10px; /* Offset for checkerboard pattern */
  }
  
  /* Preview Canvas styling */
  #preview-canvas {
    display: block; /* Ensure it takes up space */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 4px;
    background-color: transparent; /* Canvas background is handled by JS */
    cursor: grab; /* Indicate draggable */
  }
  
  #preview-canvas.dragging {
    cursor: grabbing;
  }
  
  /* Spinner styling */
  #spinner {
    display: none;
    position: absolute;
    z-index: 10; /* Above canvas */
  }
  
  /* Output info display */
  #output-info {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 4px;
    z-index: 5; /* Above canvas, below spinner */
  }
  
  /* Responsive adjustments */
  @media (max-width: 1200px) {
    .image-suite-wrapper {
      grid-template-columns: 1fr; /* Stack panels on smaller screens */
      height: auto; /* Allow height to adjust on smaller screens */
      min-height: auto;
    }
    .tool-panel {
      height: auto; /* Allow panels to adjust height */
      max-height: none; /* Remove fixed max-height */
    }
    .controls-panel {
      overflow-y: visible; /* Disable scrolling for controls on small screens if stacked */
    }
    .image-suite-container {
      align-items: flex-start; /* Align to top on smaller screens */
    }
  }
  
  @media (max-width: 768px) {
    .image-suite-container {
      padding: 1rem 0.5rem;
    }
    .tool-panel {
      padding: 1rem;
    }
    .control-group h3 {
      font-size: 1rem;
    }
    .radio-group label {
      font-size: 0.8rem;
      padding: 0.4rem;
    }
  }