/***************************************************
 *        BASIC PAGE / LAYOUT (NO SCROLLING)
 ***************************************************/

/* We ensure html/body take full viewport; 
   using no scrolling. */

  .app-container {
    /* Fill the entire screen with a flex layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    row-gap: 16px;
    width: 100%;
    height: 100%;
    /* A fallback font-family */
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  }
  
  /***************************************************
   *                   HEADER
   ***************************************************/
  .header {
    width: 100%;
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid #ccc;
  }
  .title {
    font-size: 1.8rem;
    color: #333;
    letter-spacing: 1px;
  }
  
  /***************************************************
   *           UPLOAD AREA (Drag & Drop)
   ***************************************************/
  /* Use responsive widths, no fixed pixel widths */
  .upload-area {
    position: relative;
    border: 3px dashed #999;
    border-radius: 8px;
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 80%;         /* responsive */
    max-width: 500px;   /* cap width for large screens */
    min-width: 200px;   /* optional min for extremely small screens */
  }
  .upload-area:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
  #fileInput {
    display: none;
  }
  .upload-hint {
    color: #666;
    font-size: 0.95rem;
  }
  
  /***************************************************
   *                 CONTROLS
   ***************************************************/
  .controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    width: 90%;
    max-width: 700px; /* to prevent them from stretching too wide */
    font-weight:bold;
  }
  .slider-group {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  #pixelationSlider {
    width: 120px;
    cursor: pointer;
  }
  #pixelationValue {
    width: 40px;
    text-align: right;
    display: inline-block;
  }
  
  /***************************************************
   *                 BUTTONS
   ***************************************************/
  .btn {
    background: linear-gradient(45deg, #6a5acd, #9370db);
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }
  .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  }
  .btn:active:not(:disabled) {
    transform: scale(0.98);
  }
  /* Shine effect */
  .btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
  }
  .btn:hover::before {
    left: 120%;
  }
  
  /***************************************************
   *            MAIN CONTENT / CANVAS WRAPPER
   ***************************************************/
  .main-content {
    flex: 1; /* take remaining vertical space */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* no overflow (no scrolling) */
    overflow: hidden;
  }
  
  /* The canvas-wrapper is position:relative so that 
     the selection rectangle can be absolutely placed.
     We'll set canvas size dynamically in JS. */
  .canvas-wrapper {
    position: relative;
    overflow: hidden; /* no scrollbars */
  }
  
  /* The Canvas is scaled by JS with style.width/height */
  #canvas {
    display: block;
  }
  
  /***************************************************
   *          SELECTION RECTANGLE OVERLAY
   ***************************************************/
  .selection-rect {
    display: none;
    position: absolute;
    border: 2px dashed rgba(255, 0, 0, 0.8);
    pointer-events: none;
    z-index: 999;
  }
  
  /***************************************************
   *        OPTIONAL MEDIA QUERIES (SMALL SCREENS)
   ***************************************************/
  /* If you want to further adjust layout for very narrow screens, add media queries. */
  @media (min-width:481px) and (max-width: 680px) {
    .upload-area {
        width: 70%;
        max-width: 240px;
      }
    }

  @media (max-width: 480px) {
    .header {
      padding: 6px 0;
    }
    .title {
      font-size: 1.4rem;
    }
    .upload-area {
      width: 50%;
      max-width: 240px;
    }
    .controls {
      flex-direction: column;
      gap: 8px;
    }
    .slider-group {
      width: 100%;
      justify-content: center;
    }
    .btn {
      width: 100%;
      max-width: 220px;
      margin: 0 auto;
    }
  }