html {
    scroll-behavior: smooth;
  }
  
  body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    padding: 0;
    color: var(--primary-4);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale; 
    background-color: var(--primary-1);
  }
  
  a {
      text-decoration: none;
      cursor: pointer;
      color: inherit;
  }
  
  :root {
      --primary-1: #1e1d1e;
      --primary-2: #292829;
      --primary-3: #383838;
      --primary-4: #aeaaa9;
      --primary-5: #ffffff;
      --primary-6: #006838;
      --primary-7: #009444;
  }

  .upload-wrap {
    position: relative;
    display: inline-block;
  }
  
  /* Keep it in the DOM flow, but invisible */
  .file-input {
    position: absolute;
    inset: 0;              /* covers the label area */
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
  }
  
  .file-input-button {
    appearance: none;
    -webkit-appearance: none;
  
    background: var(--button-bg, #2c2c2c);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font: inherit;
    cursor: pointer;
  
    /* Remove default file input text */
  }
  
  .file-input-button::file-selector-button {
    display: none;
  }  

  /* Smooth theme transitions */
body,
.header,
.hero,
.content,
.preview-window,
.keywords-area,
.keywords-stats,
.sidebar,
.footer,
.pill,
.pager-btn,
.icon-btn,
.icon-btn-highlight {
  transition:
    background-color 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    filter 220ms ease;
}

/* Optional: soften icon swaps slightly */
.icon,
.header-logo,
.upload-icon,
.full-screen-icon {
  transition: opacity 160ms ease, filter 220ms ease;
}

  /* ------------------------------------------------------------
     App 
  ------------------------------------------------------------ */

  .app-wrapper {
    width: 100vw;
    height: 100vh;
    background-color: var(--primary-1);
  
    display: flex;
    flex-direction: column;
  }
  
  /* ------------------------------------------------------------
     Header
  ------------------------------------------------------------ */
  
  .header-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--primary-2);
    border-bottom: solid 1px var(--primary-3);
    border-top: solid 1px var(--primary-3);
    padding: 6px 10px;
    flex-shrink: 0;
    }

    /* left + right grow to use remaining space */
    .left-header-wrapper,
    .right-header-wrapper{
    flex: 1 1 0;          /* grow + shrink, start at 0 so they share space evenly */
    min-width: 0;         /* prevents overflow issues with long content */
    }

    /* left content aligned left, right content aligned right */
    .left-header-wrapper{
    display: flex;
    justify-content: flex-start;
    }

    .right-header-wrapper{
    display: flex;
    justify-content: flex-end;
    }

    /* center keeps natural width and is centered */
    .center-header-wrapper{
    flex: 0 0 auto;       /* do not grow/shrink; width = content */
    white-space: nowrap;  /* optional: keep center content on one line */
    }

    .screen-mode-wrapper {
        display: flex;
        background-color: var(--primary-1);
        border-radius: 100px;
        padding: 2px;
    }

    .icon-btn,
    .icon-btn-highlight {
    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 4px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    }

    .icon-btn-highlight {
        background-color: var(--primary-2);
        border-color: var(--primary-3);
      }

    .icon {
        width: 14px;
        height: 14px;
        padding: 5px;
        cursor: pointer;
    }

    .header-logo {
        width: 120px;
        margin-top: 5px;
    }

    /* Container that holds both buttons */
        .header-actions {
        display: flex;
        align-items: center;
        gap: 6px; /* 4px gap between buttons */
        padding: 6px; /* 4px padding inside wrapper */
        border-radius: 6px; /* subtle rounded corners */
        background-color: var(--primary-1);
    }
    
    /* Shared button styling */
    .header-btn {
        border-radius: 3px;              /* slightly rounded edges */
        padding: 8px 20px;                /* wider sides than top/bottom */
        font-size: 14px;
        line-height: 1;
        border: 1px solid transparent;
        cursor: pointer;
        white-space: nowrap;
    
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
  
  /* Upload button */
  .header-btn--upload {
    background-color: var(--primary-2);
    border-color: var(--primary-3);
    color: var(--primary-5);
  }
  
  /* Generate button */
  .header-btn--generate {
    background-color: var(--primary-6);
    border-color: var(--primary-7);
    color: #FFF; 
  }
  
  /* Optional: hover/focus polish */
  .header-btn:hover {
    filter: brightness(1.2);
  }
  
  .header-btn:active {
    transform: translateY(1px);
  }
  
  .header-btn:focus-visible {
    outline: 2px solid var(--primary-3);
    outline-offset: 2px;
  }


  /* Theme toggle group: animated highlight */
.theme-toggle {
  position: relative;
  display: inline-flex;
  gap: 12px;
  padding: 6px;
  border-radius: 999px;
  background: var(--primary-2);
  border: 1px solid var(--primary-3);
  transition: background-color 220ms ease, border-color 220ms ease;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc(50% - 6px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(0);
  transition: transform 220ms ease, background-color 220ms ease;
  pointer-events: none;
}

/* When light is active, move highlight to the right */
.theme-toggle[data-theme="light"]::before {
  transform: translateX(100%);
}

/* Keep the two buttons above the highlight */
.theme-toggle > .icon-btn,
.theme-toggle > .icon-btn-highlight {
  position: relative;
  z-index: 1;
}

  
  /* ------------------------------------------------------------
     Workspace
  ------------------------------------------------------------ */
  
    .app-workspace {
        display: flex;
        flex: 1;
        padding: 12px;
        overflow: auto;
        gap: 12px;                
    }
    
    .redaction-set-wrapper,
    .preview-window-wrapper {
        background-color: var(--primary-2);
        border: 1px solid var(--primary-3);
        border-radius: 10px;
        min-height: 0;            
    }
    
    .redaction-set-wrapper {
        flex: 0 1 auto;            
        width: fit-content;        
        max-width: 100%;           
        min-width: 0;              
    }
    
    .preview-window-wrapper {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-width: 420px;
        min-height: 0;       /* important when children scroll */
        height: 100%;        /* only works if the parent has a height */
      }

      .preview-window canvas {
        border-radius: 0 !important;
      }

    .card-wrapper {
        padding: 10px;
    }

    .banner-wrapper {
        border-bottom: 1px solid var(--primary-3);
        padding: 0px;
        text-align: center;
    }

    .banner-title {
        font-size: 14px;
        line-height: 1;
        color: var(--primary-4);
        margin: 12px 0px;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block; /* or inline-block if needed */
    }
    

    .app-btn {
        background-color: var(--primary-2);
        color: var(--primary-5); 
        border-radius: 3px;              
        padding: 7px 20px;                
        font-size: 14px;
        line-height: 1;
        border: 1px solid var(--primary-3);
        cursor: pointer;
        white-space: nowrap;
    
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      .app-btn:hover {
        filter: brightness(1.2);
      }
      
      .app-btn:active {
        transform: translateY(1px);
      }
      
      .app-btn:focus-visible {
        outline: 2px solid var(--primary-3);
        outline-offset: 2px;
      }

      .keyword-input {
        background-color: var(--primary-1);
        border: solid 1px var(--primary-3);
        padding: 6px;
        border-radius: 6px;
        display: flex;
        flex: 1;
        justify-content: space-between; /* This pushes them to opposite sides */
        align-items: center; /* Optional: vertically center them */
        margin: 10px 0px 0px 0px;
      }
      

      .input {
        background-color: transparent;
        border: none;
        color: var(--primary-5);
      }

      input:focus {
        outline: none;
      }

      input::placeholder {
        color: var(--primary-4);
      }

      .input-window {
        background-color: var(--primary-1);
        border: solid 1px var(--primary-3);
        padding: 10px;
        width: 350px;
        height: 250px;
        border-radius: 6px;
        display: flex;                
        flex-direction: column;       
        justify-content: space-between; 
      }

      .input-text {
        overflow-y: auto;
        height: 100%;
      }

      /* Fullscreen keywords panel */
      .input-wrapper.is-fullscreen {
        position: fixed;
        inset: 90px 16px 16px 16px; /* leaves room for the header */
        z-index: 9999;
        background: var(--primary-2);
        border: 1px solid var(--primary-3);
        border-radius: 10px;
        padding: 12px;
        box-shadow: 0 20px 80px rgba(0,0,0,0.35);
      }

      .input-wrapper.is-fullscreen .input-window {
        width: auto;
        height: calc(100% - 64px); /* keeps room for input row/footer */
      }

      /* Optional: widen pill area in fullscreen */
      .input-wrapper.is-fullscreen .input-text {
        height: 100%;
      }

      /* Prevent page scroll while fullscreen is open */
      body.is-modal-open {
        overflow: hidden;
      }


      /* Fullscreen close button */
      .input-wrapper .fullscreen-close {
        display: none;
      }

      .input-wrapper.is-fullscreen .fullscreen-close {
        display: flex;
      }

      .fullscreen-close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        border-radius: 999px;
        background: transparent;
        color: var(--primary-4);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 22px;
        line-height: 1;
        z-index: 10000;
        transition: background-color 160ms ease, transform 120ms ease;
      }

      .fullscreen-close:hover {
        color: var(--primary-5);
      }

      .fullscreen-close:active {
        transform: scale(0.96);
      }

      .fullscreen-close:focus-visible {
        outline: 2px solid var(--primary-6);
        outline-offset: 2px;
      }

      .card-footer-icons {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin-top: 10px;
      }

      .full-screen-icon {
        width: 15px;
        height: 15px;
        padding: 0px 0px 2px 0px;
        cursor: pointer;
      }

      .upload-icon {
        width: 20px;
        height: 20px;
        cursor: pointer;
      }

      .stat-label {
        padding: 5px 10px;
        border-right: solid 1px var(--primary-3);
        width: 100%;
      }

      .stat-number {
        padding: 5px 10px;
        width: 100%;
      }

      .label-text {
        font-size: 14px;
        line-height: 0;
        color: var(--primary-4); 
        text-align: left;
        padding: 0px 5px 0px 0px;
      }

      .stat-text {
        font-size: 14px;
        line-height: 0;
        color: var(--primary-4); 
        text-align: right;
      }

      .stat-wrapper {
        outline: solid 1px var(--primary-3);
        border-radius: 4px;
        display: flex;
        margin: 15px 0px;
      }

      .info-bar {
        display: flex;
        justify-content: space-between;
        min-width: 0; /* allow children to shrink */
      }
      
      .info-card {
        padding: 0px 15px;
        border-bottom: solid 1px var(--primary-3);
        border-right: solid 1px var(--primary-3);
        width: 100%;
      
        min-width: 0;      /* 🔥 CRITICAL for ellipsis in flexbox */
        overflow: hidden;  /* prevents content push */
      }

      .preview-window {
        flex: 1 1 auto;
        min-height: 0;      
        width: 100%;
        overflow: auto;     
        display: flex;
        align-items: center;
        justify-content: center;
      }
      

      .doc-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px;
        border-top: 1px solid var(--primary-3);
      }

      .page-indicator {
        color: var(--primary-4);
        font-size: 0.85rem;
      }
      
      .pager {
        display: inline-flex;
        gap: 6px;
      }
      
      .pager-btn {
        padding: 2px 8px 4px 8px;
        border-radius: 8px;
        border: 1px solid var(--primary-3);
        background: var(--primary-1);
        color: var(--primary-4);
        cursor: pointer;
      }
      
      .pager-btn:hover {
        filter: brightness(1.2);
      }
      
      .pager-btn:active {
        transform: translateY(1px);
      }
      
      .pager-btn:focus-visible {
        outline: 2px solid var(--primary-3);
        outline-offset: 2px;
      }

      /* Redaction toggle */
    .checkline {
      display: inline-flex;
      align-items: center;
      gap: 14px;
      cursor: pointer;
      user-select: none;
    }

    /* Hide native checkbox but keep it accessible */
    .checkline input[type="checkbox"] {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }

    /* Custom switch track */
    .checkline .label-text {
      position: relative;
      padding-left: 54px;
      font-size: 14px;
      color: var(--primary-5);
    }

    /* Track */
    .checkline .label-text::before {
      content: "";
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 42px;
      height: 22px;
      border-radius: 999px;
      background: var(--primary-3);
      transition: background-color 200ms ease;
    }

    /* Thumb */
    .checkline .label-text::after {
      content: "";
      position: absolute;
      left: 3px;
      top: 50%;
      transform: translateY(-50%);
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: #FFF;
      transition: transform 200ms ease, background-color 200ms ease;
    }

    /* Checked state */
    .checkline input:checked + .label-text::before {
      background: var(--primary-7);
    }

    .checkline input:checked + .label-text::after {
      transform: translate(20px, -50%);
    }

    /* Hover polish */
    .checkline:hover .label-text::before {
      filter: brightness(1.1);
    }

    /* Keyboard focus */
    .checkline input:focus-visible + .label-text::before {
      outline: 2px solid var(--primary-7);
      outline-offset: 2px;
    }

    /* Responsive: stack panels under 1000px */
    @media (max-width: 999px) {
        .app-workspace {
        display: block;
        }
    
        .redaction-set-wrapper,
        .preview-window-wrapper {
        width: 100%;
        }
    
        .redaction-set-wrapper {
        width: 100%;             
        margin-bottom: 15px;     
        }
    
        .preview-window-wrapper {
        min-width: 0;            
        }

        .input-window {
            width: 100%;
          }

        .app-wrapper {
            height: auto;
        }
    }  

  /* ------------------------------------------------------------
     Controll Panel
  ------------------------------------------------------------ */


  /* Keyword pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 0px 0px 0px 15px;
  margin: 10px 10px 0 0;

  border-radius: 999px;
  border: 1px solid var(--primary-3);
  background: transparent;
  color: var(--primary-5);

  user-select: none;
}

.pill-text {
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.pill-x {
  width: 25px;
  height: 25px;
  margin-bottom: 2px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  color: var(--primary-4);
  cursor: pointer;

  font-size: 20px;
  line-height: 1;
  opacity: 0.55;
}

.pill-x:hover {
  opacity: 0.9;
  filter: brightness(1.2);
}

.pill-x:active {
  transform: translateY(1px);
}

.pill-x:focus-visible {
  outline: 2px solid var(--primary-3);
  outline-offset: 2px;
}

  /* ------------------------------------------------------------
     Preview
  ------------------------------------------------------------ */

  /* Redaction overlay */
.redaction-layer {
  position: absolute;
  inset: 0;
  pointer-events: none; /* overlays shouldn't block scrolling/clicks */
}

.redaction-rect {
  position: absolute;
  background: #000;
}
