/* =========================================
   css/styles.css  (all original rules + fixes)
   ========================================= */

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== CORE VARIABLES ===== */
:root {
    --color-bg-dark:   #1e1e2e;
    --color-bg-medium: #2b2b3b;
    --color-bg-light:  #3d3d55;
    --color-text-light:  #f0f0f5;
    --color-text-medium: #c0c0c0;
    --color-primary:    #0775f9;
    --color-secondary:  #585878;
    --color-accent:     #00d084;
    --color-error:      #e24c4b;
    --color-success:    #28a745;
--color-warning:   #ff9800;
--color-info:      #17a2b8;
    --color-border:     #44455a;
    --font-base:        'Segoe UI', Tahoma, Verdana, sans-serif;
    --nav-height:       60px;
}

/* ===== UTILITY CLASSES ===== */
.no-select {
    user-select: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.mt-8 {
    margin-top: 8px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mt-12 {
    margin-top: 12px;
}

.m-0 {
    margin: 0;
}

.flex-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ===== BODY ===== */
body {
    font-family: var(--font-base);
    background-color: var(--color-bg-dark);
    background-attachment: fixed;
    color: var(--color-text-medium);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* ===== SCROLLBAR ===== */
body::-webkit-scrollbar {
    width: 8px;
}
body::-webkit-scrollbar-track {
    background: var(--color-bg-medium);
}
body::-webkit-scrollbar-thumb {
    background-color: var(--color-secondary);
    border-radius: 4px;
}
body::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-primary);
}

/* =========================================
   HEADER
   ========================================= */
.site-header {
    background-color: var(--color-bg-medium);
    border-bottom: 1px solid var(--color-border);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.site-title {
    font-size: 1.5rem;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-logo {
    max-height: 40px;
}
.site-tagline {
    font-size: 0.9rem;
    opacity: 0.8;
}
.app-version {
    font-size: 0.85rem;
    margin-left: 6px;
    color: var(--color-text-light);
    opacity: 0.8;
}
.beta-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--color-warning);
    color: #000;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
@media (max-width: 600px) {
    .site-title,
    .header-right {
        width: 100%;
    }
}
.user-welcome {
    color: var(--color-text-light);
    font-size: 1rem;
}

/* ===== USER NAVIGATION ===== */
.user-topbar {
    background: var(--color-bg-medium);
    color: var(--color-text-light);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 20px;
    margin-bottom: 20px;
}

.user-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0;
    margin: 0;
}

.user-links li a {
    color: var(--color-text-light);
    text-decoration: none;
}

.user-links li a:hover {
    text-decoration: underline;
    background: var(--color-bg-dark);
    color: var(--color-primary);
}

.user-links a.active {
    font-weight: 600;
    border-left: 3px solid var(--color-primary);
    background: var(--color-bg-dark);
    color: var(--color-primary);
}

.current-user {
    margin-left: 1rem;
}

.user-logo {
    margin-right: auto;
    font-weight: bold;
}

.top-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 10px;
}

.top-nav-close {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .user-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-links {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
}

@media (max-width: 600px) {
  .top-nav-toggle,
  .top-nav-close {
    display: block;
  }
  body.mobile-nav #userTopNav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background: var(--color-bg-medium);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }
  body.mobile-nav #userTopNav[data-open="true"] {
    transform: translateX(0);
  }

  body.mobile-nav #userNavOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 999;
  }
  body.mobile-nav #userNavOverlay[data-open="true"] {
    opacity: 1;
    visibility: visible;
  }

  body.mobile-nav #userNavToggle {
    position: absolute;
    left: 100%;
    top: 0.5rem;
    font-size: 2rem;
    background: none;
    border: 0;
  }
  body.mobile-nav #userTopNav[data-open="true"] #userNavToggle {
    display: none;
  }

  body.mobile-nav #userNavClose {
    display: none;
  }
  body.mobile-nav #userTopNav[data-open="true"] #userNavClose {
    display: block;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 2rem;
    background: none;
    border: 0;
  }
}

/* =========================================
   FOOTER
   ========================================= */
.site-footer {
    background-color: var(--color-bg-medium);
    color: var(--color-text-light);
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

/* ===== BUTTON STYLES ===== */
.btn {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
}
.btn.small {
    padding: 4px 8px;
    font-size: 0.8rem;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
}
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-light);
}
.btn-primary:hover {
    background-color: #055ecb;
}
.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-text-light);
}
.btn-secondary:hover {
    background-color: #424258;
}
[data-theme='light'] .btn-primary,
[data-theme='light'] .btn-secondary {
    color: var(--color-text-light);
}
.btn-success {
    background-color: var(--color-success);
    color: #ffffff;
}
.btn-danger {
    background-color: var(--color-error);
    color: #ffffff;
}
.btn-info {
    background-color: var(--color-accent);
    color: #ffffff;
}
.btn-warning {
    background-color: #ff9800;
    color: #ffffff;
}
.btn-delete {
    background-color: #640000;
    color: #ffffff;
}

/* /* =========================================
   TABS NAVIGATION  (fixed + glossy)
   ========================================= */
.tabs-nav {
    background-color: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
}

.tabs-list {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 8px 10px;            /* breathing room for pills */
    gap: 10px;
}

/* pill base */
.tab-item {
    flex: 1 1 0;
    min-width: 180px;             /* prevents label collapse on narrow screens */
    text-align: center;
    padding: 12px 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 12px;          /* pill look */
    color: var(--color-text-light);
    background:
      linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0)),
      color-mix(in oklab, var(--color-bg-medium), black 6%);
    border: 1px solid color-mix(in oklab, var(--color-border), black 6%);
    box-shadow:
      0 6px 16px rgba(0,0,0,.25),
      inset 0 1px 0 rgba(255,255,255,.06);
    transition: transform .15s ease, box-shadow .2s ease, background .25s ease;
}

.tab-icon { font-size: 1.15rem; }
.tab-label { font-size: 0.96rem; line-height: 1; }

/* hover */
.tab-item:hover {
    transform: translateY(-1px);
    background:
      linear-gradient(135deg, #8e2de2, #4a00e0);
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(0,0,0,.28);
}

/* active — glossy gradient + guaranteed readable text */
.tab-item.active {
    background:
      radial-gradient(120% 140% at 0% 0%, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 60%),
      linear-gradient(135deg, #6a11cb, #2575fc);
    color: #fff !important;
    font-weight: 600;
    border-color: transparent;
    box-shadow:
      0 12px 28px rgba(0,0,0,.32),
      inset 0 1px 0 rgba(255,255,255,.20);
    background-size: 180% 180%;
    animation: gradientShift 6s ease infinite;
}

/* make sure both icon and label stay visible in all themes */
.tab-item.active .tab-icon,
.tab-item.active .tab-label,
.tab-item:hover .tab-icon,
.tab-item:hover .tab-label {
    color: #fff !important;
}

/* compact single-column on phones */
@media (max-width: 768px) {
    .tabs-list { flex-direction: column; gap: 8px; }
    .tab-item { min-width: 0; padding: 12px; }
}

/* subtle animated sheen */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* =========================================
   MAIN CONTENT 
   ========================================= */
.main-content {
    flex: 1;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* -----------------------------------------
   NOTE: panes primarily use the .tab-content-pane class.
   The .tab-pane styles remain only for legacy support.
   ----------------------------------------- */

.tab-content-pane {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--color-bg-medium);
}
.tab-content-pane#cleanTextTab,
#cleanTextTab {
    overflow: visible;
}
.tab-content-pane.active {
    display: block;
}

.tab-pane {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--color-bg-medium);
}
.tab-pane.active {
    display: block;
}

/* =========================================
   ALERTS
   ========================================= */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    transform: none;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 4px;
    animation: fadeIn 0.3s ease-out;
    min-width: 220px;
    font-size: 0.85rem;
}
.alert.success {
    background-color: var(--color-success);
}
.alert.error {
    background-color: var(--color-error);
}
.alert.warning {
    background-color: var(--color-warning);
}
.alert.info {
    background-color: var(--color-info);
}
.alert .close-btn {
    margin-left: auto;
    cursor: pointer;
    font-weight: bold;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}
@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* =========================================
   BACK TO TOP BUTTON
   ========================================= */
.back-to-top-btn {
    position: fixed;
    right: 20px;
    bottom: 80px;
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.back-to-top-btn:hover {
    background-color: #055ecb;
}

/* =========================================
   CLEAN TEXT: INPUT SECTION (tool1.php)
   ========================================= */
.input-section {
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: transparent;
}
.control-item {
    margin-bottom: 15px;
}
.control-item label {
    display: block;
    margin-bottom: 6px;
    color: var(--color-text-light);
    font-size: 1rem;
}
.input-section textarea#inputText {
    width: 100%;
    min-height: 120px;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 10px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}
.input-section textarea#inputText:focus {
    outline: none;
    border-color: var(--color-primary);
}
.input-section .controls {
    margin-bottom: 15px;
}
.input-section .button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.input-section .button-group button {
    font-size: 0.9rem;
    padding: 8px 14px;
}
.checkbox-row,
.output-panel .checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-item,
.output-panel .checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text-light);
}
.input-section input#regexPattern {
    width: 100%;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
.input-section input#regexPattern:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* =========================================
   OUTPUT + SIDEBAR SECTION (tool1.php)
   ========================================= */
.text-sidebar-layout {
    display:flex;
    align-items:flex-start;
    gap:24px;
    padding:20px;
    overflow: visible;
}
#left-column {
    flex:1;
    overflow: visible;
}
#processed-text {
    width: 100%;
    position: relative;
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-word;
    counter-reset: paragraph-counter;
}
.paragraph-wrapper {
    display:flex;
    counter-increment: paragraph-counter;
    margin-bottom:1em;
}
.paragraph-wrapper:last-child {
    margin-bottom:0;
}
.paragraph-wrapper.blank {
    counter-increment: none;
}

.paragraph-wrapper.blank .paragraph-text {
    min-height: 1em;
}
.paragraph-number {
    width:2em;
    color:#888;
    margin-right:8px;
    user-select:none;
    pointer-events:none;
    flex-shrink:0;
    text-align:right;
}
.paragraph-number::before {
    content: counter(paragraph-counter);
}
#right-sidebar {
    flex:0 0 280px;
    position:-webkit-sticky;
    position:sticky;
    top:0;
    align-self:flex-start;
    height:fit-content;
}

.output-panel {
    border-radius: 6px;
    padding: 20px;
    overflow: visible;
    background-color: transparent;
}
.output-panel h3 {
    color: var(--color-text-light);
    margin-bottom: 10px;
}

.file-name-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px;
    background: var(--color-bg-light);
    border-radius: 6px;
}

.output-controls-wrapper {
    position: sticky;
    top: var(--nav-height);
    z-index: 20;
    background: var(--color-bg-light);
}

/* SIDEBAR (tool1.php) */
.sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Search & Replace (tool1.php) */

.search-replace-box h3 {
    color: var(--color-text-light);
    margin-bottom: 10px;
}
.search-replace-box .search-input {
    width: 100%;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 8px;
    font-size: 0.95rem;
    margin-bottom: 10px;
}
.search-replace-box .search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}
.search-replace-box .button-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.search-replace-box .search-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.search-replace-box .search-stats {
    margin-top: 15px;
    color: var(--color-text-light);
    font-size: 0.9rem;
}
.search-replace-box .search-stats p {
    margin-bottom: 6px;
}

/* Exceptions & Transformations (tool1.php) */
.exceptions-box {
    border-radius: 6px;
    padding: 15px;
}
.exceptions-box h3 {
    color: var(--color-text-light);
    margin-bottom: 10px;
}
.exceptions-box .input-box {
    width: 100%;
    min-height: 60px;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 8px;
    font-size: 0.95rem;
    margin-bottom: 10px;
    resize: vertical;
}
.exceptions-box .input-box:focus {
    outline: none;
    border-color: var(--color-primary);
}
.exceptions-box .controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    align-items: center;
}
.exceptions-box .controls input.search-input {
    flex: 1;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 6px;
    font-size: 0.9rem;
}
.exceptions-box .controls input.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}
.exceptions-box .controls button {
    font-size: 0.9rem;
    padding: 6px 12px;
}

/* Statistics (tool1.php) */
.statistics-box {
    border-radius: 6px;
    padding: 15px;
}
.statistics-box h3 {
    color: var(--color-text-light);
    margin-bottom: 10px;
}
.statistics-box p {
    margin-bottom: 6px;
    font-size: 0.9rem;
}
.stat-number-red {
    color: var(--color-error);
    font-weight: bold;
}
.stat-number-green {
    color: var(--color-success);
    font-weight: bold;
}

/* Function Descriptions (tool1.php) */
.function-descriptions {
    background-color: var(--color-bg-dark);
    border-radius: 6px;
    padding: 20px;
}
.function-descriptions h2 {
    color: var(--color-text-light);
    margin-bottom: 15px;
}
.description-columns {
    display: flex;
    gap: 20px;
}
.description-column {
    flex: 1;
}
.description-column h3 {
    color: var(--color-text-light);
    margin-bottom: 8px;
    font-size: 1.1rem;
}
.description-column ul {
    list-style-type: disc;
    padding-left: 20px;
}
.description-column ul li {
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--color-text-medium);
}

/* =========================================
   CHUNK SPLIT (tool2.php)
   ========================================= */
.chunk-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    color: var(--color-text-light);
}

/* Header & description */
.chunk-header h2 {
    font-size: 1.75rem;
    color: var(--color-text-light);
    margin-bottom: 8px;
}
.chunk-header .chunk-description {
    font-size: 0.95rem;
    color: var(--color-text-light);
    margin-bottom: 12px;
}

/* Input area */
.chunk-input-area .chunk-input-text {
    width: 100%;
    min-height: 150px;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 10px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}
.chunk-input-area .chunk-input-text:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Buttons */
.chunk-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.chunk-buttons .btn {
    font-size: 0.9rem;
    padding: 8px 12px;
}

/* Notification at bottom */
.chunk-notification {
    font-size: 0.9rem;
    color: var(--color-success);
    min-height: 1.2em;
    text-align: center;
    margin-top: 8px;
}

/* Area for displaying split parts */
.chunk-display-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    color: var(--color-text-light);
}
.chunk-part h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: var(--color-text-light);
}
.chunk-part .chunk-input-text {
    width: 100%;
    min-height: 100px;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 8px;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s;
}
.chunk-part .chunk-input-text:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Dynamic “Copy Part N” buttons */
.chunk-display-text .btn-secondary {
    margin-top: 4px;
}

/* “How It Works” explanations */
.chunk-explanations {
    margin-top: 20px;
    color: var(--color-text-light);
}
.chunk-explanations h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--color-text-light);
}
.chunk-explanations ul {
    padding-left: 20px;
    list-style: disc;
}
.chunk-explanations li {
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* =========================================
   STRESS TOOL (tool3.php)
   ========================================= */
.stress-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 800px; /* Align width with Chunk Split */
    margin: 0 auto;
    padding: 0 16px; /* Add side padding */
    color: var(--color-text-light);
}

/* Header & description */
.stress-container h2 {
    font-size: 1.75rem;
    color: var(--color-text-light);
    margin-bottom: 8px;
}
.stress-container p {
    font-size: 0.95rem;
    color: var(--color-text-light);
    margin-bottom: 12px;
}

/* Input group */
.stress-input-group {
    display: block;
    width: 100%;
}
.stress-input-group .stress-textarea {
    width: 100%;
    min-height: 200px; /* Match Chunk Split input height */
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 10px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}
.stress-input-group .stress-textarea::placeholder {
    color: var(--color-text-light);
}
.stress-input-group .stress-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Buttons row in Stress Tool */
.stress-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}
.stress-buttons button#processStressBtn {
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.stress-buttons button#processStressBtn:hover {
    background-color: #055ecb;
}
.stress-buttons button#copyProcessedBtn,
.stress-buttons button#clearProcessedBtn,
.stress-buttons button#clearAllStressBtn {
    background-color: var(--color-secondary);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.stress-buttons button#copyProcessedBtn:hover,
.stress-buttons button#clearProcessedBtn:hover,
.stress-buttons button#clearAllStressBtn:hover {
    background-color: #424258;
}

/* Output group (Stress Tool) */
.stress-output-area {
    display: block;
    width: 100%;
    margin-top: 8px;
}
.stress-output-area .stress-textarea {
    width: 100%;
    min-height: 200px; /* Match input height */
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 10px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}
.stress-output-area .stress-textarea::placeholder {
    color: var(--color-text-light);
}
.stress-output-area .stress-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Statistics block for Stress Tool */
.stress-stats-box {
    background-color: var(--color-bg-light);
    border-radius: 6px;
    padding: 12px;
}
.stress-stats-box h3 {
    color: var(--color-text-light);
    margin-bottom: 8px;
}
.stress-stats-box p {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.stress-dedupe-box {
    background-color: var(--color-bg-light);
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}
.stress-dedupe-box h3 {
    color: var(--color-text-light);
    margin-bottom: 8px;
}
.stress-duplicate-list label {
    display: block;
    margin-bottom: 4px;
}
.stress-dedupe-box button {
    background-color: var(--color-secondary);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 6px;
}
.stress-dedupe-box button:hover:not(:disabled) {
    background-color: #424258;
}
.stress-dedupe-box button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.stress-dedupe-confirm {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 8px 0;
}

/* Popup for selecting stress variants */
.stress-variant-popup {
    position: absolute;
    background-color: var(--color-bg-medium);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    padding: 8px;
    border-radius: 4px;
    z-index: 1000;
}

.stress-variant-popup ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stress-variant-popup div {
    padding: 4px 8px;
    cursor: pointer;
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
}

.stress-variant-popup div:hover {
    background-color: var(--color-primary);
    color: var(--color-text-light);
}

/* =========================================
   ADAPTIVE / RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .text-sidebar-layout {
        flex-direction: column;
    }
    .description-columns {
        flex-direction: column;
    }
    .chunk-buttons {
        flex-direction: column;
    }
    .chunk-display-text {
        flex-direction: column;
    }
    .stress-buttons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .text-sidebar-layout {
        flex-direction: column;
    }
    #right-sidebar {
        position: static;
        max-height: none;
    }
    .tabs-list {
        flex-direction: column;
    }
    .tab-item {
        padding: 10px 0;
    }
    .sidebar {
        flex-direction: column;
    }
    .output-panel, .sidebar {
        margin-bottom: 20px;
    }
    .exceptions-box .controls,
    .search-replace-box .button-group {
        flex-direction: column;
    }
    .chunk-container {
        padding: 0 10px;
    }
    .stress-container {
        padding: 0 10px;
    }
}

/* --- Highlight (search & duplicates) --- */
.highlight {
    background-color: rgba(255, 205, 0, 0.4);  /* Soft yellow */
    border-radius: 2px;
}
.highlight.selected {
    background-color: rgba(255, 0, 0, 0.3);
}

/* Highlight style for ElevenLabs output */
.elevenlabs-highlight {
    background-color: rgba(0, 136, 255, 0.3); /* soft blue highlight */
    border-radius: 2px;
}

/* ===== LIGHT THEME ===== */
[data-theme='light'] {
    --color-bg-dark: #ffffff;
    --color-bg-medium: #f4f4f4;
    --color-bg-light: #e9e9e9;
    --color-text-light: #1e1e1e;
    --color-text-medium: #333333;
    --color-border: #cccccc;
}

/* ===== Editor Page ===== */
.editor-container {
    max-width: 960px;
    margin: 40px auto;
    background: #1f1f2e;
    padding: 30px;
    border-radius: 10px;
    color: #fff;
    font-family: sans-serif;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.editor-container textarea {
    width: 100%;
    height: 500px;
    background: #12121c;
    color: #fff;
    font-family: monospace;
    border: 1px solid #444;
    padding: 1rem;
    resize: vertical;
    border-radius: 5px;
}

.editor-actions {
    margin-top: 1rem;
    display: flex;
    gap: 10px;
}

.back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #aaf;
    text-decoration: none;
}

/* Consistent heading spacing */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* Paragraph spacing */
p {
    margin-bottom: 15px;
}

/* Banned account warning */
.banned-warning {
    background-color: rgba(226, 76, 75, 0.1);
    color: var(--color-error);
    padding: 10px 15px;
    border: 1px solid var(--color-error);
    border-radius: 4px;
    text-align: center;
    margin-bottom: 20px;
}

/* =========================================
   PROFILE PAGE ENHANCEMENTS
   ========================================= */

.profile-container {
    background-color: var(--color-bg-light);
    color: var(--color-text-light);
    padding: 30px 40px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    margin: 40px auto;
}

.profile-container h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.6rem;
    text-align: center;
}

.profile-container .section {
    margin-bottom: 20px;
}

.profile-container .section h2,
.section h2 {
    margin: 0 0 10px;
    font-size: 1.25rem;
}

.profile-container .section p,
.section p {
    margin: 4px 0;
}

/* Flash messages */
.flash-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
}
.flash-message.error {
    background-color: #f8d7da;
    color: #721c24;
}
.flash-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Profile badges */
.profile-badges {
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--color-text-light);
}

.badge-admin,
.badge.admin {
    background-color: var(--color-primary, #b52e31);
}
.badge-moderator {
    background-color: #2e6da4;
}
.badge-user {
    background-color: #5bc0de;
}
.badge-paid,
.badge.paid {
    background-color: var(--color-success, #28a745);
}
.badge-free,
.badge.free {
    background-color: var(--color-secondary, #6c757d);
}
.badge.banned {
    background-color: var(--color-error);
}

[data-theme='light'] .badge-admin,
[data-theme='light'] .badge.admin {
    background-color: #cce5ff;
}
[data-theme='light'] .badge-moderator {
    background-color: #b8daff;
}
[data-theme='light'] .badge-user {
    background-color: #d1ecf1;
}
[data-theme='light'] .badge-paid,
[data-theme='light'] .badge.paid {
    background-color: #d4edda;
}
[data-theme='light'] .badge-free,
[data-theme='light'] .badge.free {
    background-color: #e2e3e5;
}
[data-theme='light'] .badge.banned {
    background-color: #f8d7da;
}

/* Profile form */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-form label {
    font-weight: bold;
}

.profile-form input[type="text"],
.profile-form input[type="email"],
.profile-form input[type="password"],
.profile-form select,
.profile-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-bg-dark, var(--color-bg-medium));
    color: var(--color-text-light);
}

.profile-form button {
    padding: 10px;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    align-self: flex-start;
}

.profile-form button:hover {
    background-color: #055ecb;
}

/* Responsive */
@media (max-width: 600px) {
    .profile-container {
        padding: 20px;
        margin: 20px auto;
    }

    .profile-container h1 {
        font-size: 1.4rem;
    }

    .profile-form button {
        font-size: 0.9rem;
    }
}
/* Upgrade modal (readable in both themes) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px); /* soft focus */
}
.modal.show { display: flex; }

.modal-content {
    background:
      radial-gradient(160% 120% at 10% -10%, rgba(99, 102, 241, .18) 0%, rgba(99, 102, 241, 0) 55%),
      linear-gradient(180deg, #1f2030, #171827);
    color: #f7f8ff;                 /* force high contrast text */
    padding: 1.8rem;
    border-radius: 14px;
    width: 88%;
    max-width: 520px;
    box-shadow: 0 18px 48px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    position: relative;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    color: #e9ecff;                 /* readable close icon */
    font-size: 24px;
    cursor: pointer;
}

/* Buttons inside modal inherit your .btn styles – make sure they pop */
.modal .btn-primary {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: #fff;
    border: 0;
    box-shadow: 0 8px 18px rgba(0,0,0,.35);
}
.modal .btn-primary:hover {
    filter: brightness(1.05);
}

/* Sticky action bar for admin edit page */
.action-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px;
    border-top: 1px solid #ccc;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    z-index: 10;
}

@media (max-width: 600px) {
    .action-bar {
        position: fixed;
        left: 0;
        right: 0;
    }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity .3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* Active tab state fix */
.tab-item.active {
    background: linear-gradient(135deg, #6a11cb, #2575fc); /* Modern glossy gradient */
    color: #fff !important; /* Force text to be visible */
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

/* Ensure icons remain visible */
.tab-item.active .tab-icon {
    color: #fff !important;
}

/* Normal tab hover for consistency */
.tab-item:hover {
    background: linear-gradient(135deg, #8e2de2, #4a00e0);
    color: #fff !important;
}

/* Optional glossy effect for both active and hover states */
.tab-item.active,
.tab-item:hover {
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* === Glassy / Gradient tokens === */
:root{
  --glass-bg: color-mix(in oklab, var(--color-bg-dark), transparent 40%);
  --glass-stroke: color-mix(in oklab, #ffffff, rgba(0,0,0,.3) 70%);
  --glass-shadow: 0 10px 30px rgba(0,0,0,.35);
}

/* Center the page content of tools without changing layout JS */
.tool-page-wrap{
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Glass panels/cards */
.glass-card{
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-stroke);
  border-radius: 14px;
  backdrop-filter: saturate(1.15) blur(14px);
  -webkit-backdrop-filter: saturate(1.15) blur(14px);
  box-shadow: var(--glass-shadow);
  overflow: hidden; /* keeps gradient flare inside */
}

/* Soft gradient “sheen” inside card */
.glass-card.sheen::before{
  content:"";
  position:absolute; inset:0;
  pointer-events:none; z-index:0;
  background:
    radial-gradient(55% 70% at 8% -10%, color-mix(in oklab, var(--color-primary), transparent 78%) 0, transparent 100%),
    radial-gradient(45% 60% at 100% 0%, color-mix(in oklab, var(--color-accent), transparent 82%) 0, transparent 100%);
  opacity:.55;
}
.glass-card > *{ position: relative; z-index: 1; }

/* Specific glass styling for tool1 sections */
.input-section,
.output-panel,
.search-replace-box,
.statistics-box,
.function-descriptions {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-stroke);
  border-radius: 14px;
  backdrop-filter: saturate(1.15) blur(14px);
  -webkit-backdrop-filter: saturate(1.15) blur(14px);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

.input-section.sheen::before,
.output-panel.sheen::before,
.function-descriptions.sheen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(55% 70% at 8% -10%, color-mix(in oklab, var(--color-primary), transparent 78%) 0, transparent 100%),
    radial-gradient(45% 60% at 100% 0%, color-mix(in oklab, var(--color-accent), transparent 82%) 0, transparent 100%);
  opacity: .55;
}

.input-section > *,
.output-panel > *,
.search-replace-box > *,
.statistics-box > *,
.function-descriptions > * {
  position: relative;
  z-index: 1;
}

/* Allow sticky elements inside the output panel */
.output-panel {
  overflow: visible;
}

/* Glassy fields (inputs/textarea) */
.glass-field{
  background: color-mix(in oklab, var(--color-bg-dark), white 2%);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--color-text-light);
  outline: none;
  transition: box-shadow .2s, border-color .2s;
}
.glass-field:focus{
  border-color: color-mix(in oklab, var(--color-primary), white 10%);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary), transparent 80%);
}

/* Section headings */
.section-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px;}
.section-title{
  font-weight: 700;
  letter-spacing: .2px;
  background: linear-gradient(135deg, #9b79ff, #4fd1c5);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
[data-theme='light'] .section-title{
  background: none;
  color: var(--color-text-light);
}

/* Gradient buttons */
.btn-gradient{
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  box-shadow: 0 6px 18px rgba(37,117,252,.35);
}
.btn-gradient:hover{ filter: brightness(1.05); }

.btn-glass{
  background: color-mix(in oklab, var(--color-bg-light), transparent 25%);
  border: 1px solid color-mix(in oklab, var(--color-border), white 10%);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.btn-glass:hover{ filter: brightness(1.06); }
[data-theme='light'] .btn-glass{ color: var(--color-text-light); }

/* Make core textareas/inputs adopt the glass style without touching IDs */
.input-section textarea#inputText,
.search-replace-box .search-input,
#fileName,
.exceptions-box .input-box,
#stressWordInput,
#replaceWord,
#searchWord,
#stressVariants{
  border-radius: 10px;
}

/* Details elements (Hard Words) use glass too */
/* Remove dependency on .glass-card so the style applies to any details */
details > summary{
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text-light);
  list-style: none;
}
details[open]{
  background: color-mix(in oklab, var(--color-bg-medium), transparent 20%);
}

/* Modal readability over dim backdrop */
.modal{ backdrop-filter: blur(12px); }
.modal-content{
  background: color-mix(in oklab, var(--color-bg-medium), transparent 20%);
  border: 1px solid color-mix(in oklab, var(--color-text-light), transparent 85%);
  color: var(--color-text-light);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 2rem 2.5rem;
  border-radius: 16px;
}

/* Tabs (keep your prior fixes, just ensure label is always visible) */
.tab-item{ border-radius: 12px; margin: 6px 10px; }
.tab-item .tab-label{ color: inherit; }
.tab-item.active{
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color:#fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.tab-item:hover{
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
  color:#fff;
}

/* Light theme tweaks */
[data-theme='light'] .glass-card{
  background: color-mix(in oklab, #ffffff, transparent 15%);
  border-color: #e5e7eb;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}

/* Make main containers wider */
.chunk-container,
.stress-container,
.text-sidebar-layout {
  max-width: 1100px; /* wider than current ~800px */
  width: 100%;
  margin: 0 auto;
}

/* Ensure textareas and inputs fill new width */
.chunk-input-area .chunk-input-text,
.chunk-part .chunk-input-text,
.stress-input-group .stress-textarea,
.stress-output-area .stress-textarea,
.input-section textarea,
.input-section input[type="text"] {
    width: 100%;
}

/* Optional: glossy gradient for input areas */
textarea,
input[type="text"] {
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
                var(--color-bg-dark);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-light);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.1),
                inset 0 -1px 2px rgba(0,0,0,0.3);
}

/* ===========================
   Fluid page width controls
   =========================== */
:root{
  /* tweak this to taste */
  --page-max: 1200px;
  --page-pad-inline: clamp(12px, 2vw, 24px);
}

/* center the main surface and give it breathing room */
.main-content{
  width: min(var(--page-max), 96vw);
  margin-inline: auto;
  padding-inline: var(--page-pad-inline);
}

/* Make the top "cards"/sections fluid & centered */
.text-sidebar-layout,
.chunk-container,
.stress-container,
.function-descriptions {
  width: min(var(--page-max), 96vw);
  margin-inline: auto;
}

/* Make the big text areas truly full width inside their cards */
.input-section textarea#inputText,
.chunk-input-area .chunk-input-text,
.chunk-part .chunk-input-text,
.stress-input-group .stress-textarea,
.stress-output-area .stress-textarea{
  width: 100%;
}

/* Sidebar layout: keep a sensible, fluid sidebar width */
#right-sidebar{
  flex: 0 0 clamp(280px, 26vw, 360px);
}

/* Let the left column claim the rest */
#left-column{
  min-width: 0;   /* important for flex overflow */
}

/* Chunk/Stress containers were previously capped to 800px.
   Remove that narrow cap so they follow the new page width. */
.chunk-container,
.stress-container{
  max-width: none;  /* override previous max-width:800px */
  padding-inline: 0; /* rely on .main-content padding */
}

/* On very small screens, keep everything readable */
@media (max-width: 768px){
  .main-content,
  .text-sidebar-layout,
  .chunk-container,
  .stress-container,
  .function-descriptions {
    width: 100%;
    padding-inline: var(--page-pad-inline);
  }
  #right-sidebar {
    flex: 1 1 auto; /* stack under/over the left column */
  }
}

/* =========================================================
   CLEAN TEXT – RESPONSIVE / WIDER + VISIBILITY FIXES
   (append to end of css/styles.css)
   ========================================================= */

/* 1) Make the main sections wider and center them */
.text-sidebar-layout,
.function-descriptions {
  max-width: 1200px;     /* wider like your original look */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* 2) Two-column layout that collapses nicely */
.text-sidebar-layout {
  display: grid;                /* replaces the earlier flex */
  grid-template-columns: minmax(0, 1fr) 360px; /* content + sidebar */
  gap: 24px;
  padding: 20px;
}

/* On narrower screens, stack vertically */
@media (max-width: 1100px) {
  .text-sidebar-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar container: provide its own spacing and subtle background */
#right-sidebar {
  background: var(--glass-bg);
  padding: 16px;
  border: 1px solid var(--glass-stroke);
  border-radius: 14px;
  box-shadow: var(--glass-shadow);
}

/* Selection contrast (helpful when theme toggles) */
#processed-text::selection,
#processed-text *::selection {
  background: rgba(120, 170, 255, 0.35);
  color: var(--color-text-light);
}

/* 5) Inputs and textareas stretch nicely across the new width */
.input-section textarea#inputText,
.input-section input#regexPattern,
.input-section input#fileName,
.search-replace-box .search-input {
  width: 100%;
}

/* 6) Buttons wrap gracefully on smaller widths */
.input-section .button-group,
.search-replace-box .button-group {
  flex-wrap: wrap;
  gap: 10px;
}

/* 7) Make the right card column consistent with other panels */
.output-panel,
.statistics-box,
.exceptions-box {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

/* Allow content to extend beyond card clipping */
.output-panel {
  overflow: visible;
  background-color: transparent;
}

/* 8) Keep things readable in light theme too */
[data-theme='light'] #processed-text {
  background: #ffffff;
  color: #1e1e1e;
  border-color: #cccccc;
}

/* 10) Buttons row spacing below big textarea (feels like the old layout) */
.input-section .controls + .controls {
  margin-top: 10px;
}

/* Glassy gradient style for Search and Replace block */
.search-replace-box {
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    padding: 18px;
}

/* Sticky bar for processed text controls */
#processed-tools {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--nav-height, 0);
  align-items: stretch;
  gap: 10px;
  z-index: 200;
  padding: 12px;
  width: 100%;
  background: var(--color-bg-light);
  border-bottom: 1px solid var(--color-border);
}

/* Match fields to glossy theme */
.search-replace-box input[type="text"],
.search-replace-box input[type="search"],
.search-replace-box input[type="number"],
.search-replace-box textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    padding: 8px;
    width: 100%;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.search-replace-box input:focus,
.search-replace-box textarea:focus {
    border-color: rgba(255, 255, 255, 0.4);
    outline: none;
    background: rgba(255, 255, 255, 0.08);
}

/* =========================================================
   GLASSY / GRADIENT PANELS + PILL BUTTONS + CHECKBOXES
   (Search & Replace + ElevenLabs Hard Words)
   ========================================================= */

/* ---------- Shared glass panel look ---------- */
.glass-panel {
  position: relative;
  background: linear-gradient(
      180deg,
      rgba(255,255,255,0.06) 0%,
      rgba(255,255,255,0.02) 100%
    ),
    radial-gradient(120% 100% at -10% -30%, rgba(120,167,255,0.18) 0%, transparent 55%),
    radial-gradient(120% 120% at 120% -20%, rgba(152,84,255,0.18) 0%, transparent 60%);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  box-shadow:
    0 10px 26px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

/* Make form fields inside glass panels match the look */
.glass-panel input[type="text"],
.glass-panel input[type="search"],
.glass-panel input[type="email"],
.glass-panel input[type="password"],
.glass-panel textarea {
  background: rgba(16,16,28,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--color-text-light);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.glass-panel input::placeholder,
.glass-panel textarea::placeholder {
  color: rgba(240,240,245,0.55);
}
.glass-panel input:focus,
.glass-panel textarea:focus {
  border-color: rgba(124, 187, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 187, 255, 0.18);
}

/* Make its internal fields glassy */
.search-replace-box input[type="text"] {
  width: 100%;
}

/* Space & alignment tweaks */
.search-replace-box .button-group,
.search-replace-box .controls,
#processed-tools .button-group,
#processed-tools .controls {
  gap: 6px;
  flex-wrap: wrap;
}
.search-replace-box h3 { margin-bottom: 10px; }

/* ---------- ELEVENLABS HARD WORDS: glass panel ---------- */
details > .exceptions-box {
  padding: 16px;
  background: linear-gradient(
      180deg,
      rgba(255,255,255,0.06) 0%,
      rgba(255,255,255,0.02) 100%
    ),
    radial-gradient(120% 100% at -10% -30%, rgba(120,167,255,0.16) 0%, transparent 55%),
    radial-gradient(120% 120% at 120% -20%, rgba(152,84,255,0.16) 0%, transparent 60%);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  box-shadow:
    0 10px 26px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

/* Inputs inside ElevenLabs block match the glass look (buttons left as-is) */
details > .exceptions-box input[type="text"],
details > .exceptions-box textarea {
  background: rgba(16,16,28,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--color-text-light);
  border-radius: 10px;
  padding: 10px 12px;
}
details > .exceptions-box textarea {
  min-height: 120px;
}

/* ---------- Modern checkboxes (Search & Replace + ElevenLabs) ---------- */
.search-replace-box input[type="checkbox"],
details > .exceptions-box input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(16,16,28,0.55);
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.search-replace-box input[type="checkbox"]::after,
details > .exceptions-box input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  border-radius: 3px;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  transition: transform .12s ease;
}
.search-replace-box input[type="checkbox"]:checked::after,
details > .exceptions-box input[type="checkbox"]:checked::after {
  transform: scale(1);
}
.search-replace-box label,
details > .exceptions-box label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

/* Maintain spacing between sidebar sections */
#right-sidebar .search-replace-box,
#right-sidebar .statistics-box,
#right-sidebar .exceptions-box {
  margin-bottom: 16px;
}

.marker-menu {
  display: none;
  position: absolute;

  /* Layout & sizing */
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-width: 150px;
  max-width: 90vw;

  /* Visuals */
  background-color: var(--color-bg-medium, rgba(255,255,255,0.5)); /* fallback for #fff8 */
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border-radius: 6px;
  z-index: 1000;

  /* Transitionable visibility */
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

/* When opened via id `markerMenu` */
#markerMenu.open {
  display: flex;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.marker-menu .btn {
  width: 100%;
}

.marker-menu .btn:hover {
  background-color: var(--color-bg-light);
}

@media (max-width: 600px) {
  .marker-menu {
    width: 90%;
    left: 5%;
    right: 5%;
  }
}

.marker {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: red;
  border: 1px solid #fff;
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* Make the summary look clickable with a chevron */
details.glass-card > summary {
  position: relative;
  padding: 14px 16px 14px 40px;  /* room for icon */
  list-style: none;              /* hide default marker */
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Custom caret */
details.glass-card > summary::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255,255,255,0.8);
  border-bottom: 2px solid rgba(255,255,255,0.8);
  transform: translateY(-50%) rotate(-45deg);  /* ► */
  transition: transform .18s ease;
  opacity: .9;
}

/* Rotate caret when open */
details.glass-card[open] > summary::before {
  transform: translateY(-50%) rotate(45deg);   /* ▼ */
}

/* Optional hover feedback */
details.glass-card > summary:hover {
  background: linear-gradient(0deg, rgba(255,255,255,0.05), rgba(255,255,255,0));
}

/* Custom styling for ElevenLabs Hard Words accordion */
#elevenlabsHardWords > summary {
  position: relative;
  padding: 14px 16px 14px 40px;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text-light);
  list-style: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#elevenlabsHardWords > summary::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255,255,255,0.8);
  border-bottom: 2px solid rgba(255,255,255,0.8);
  transform: translateY(-50%) rotate(-45deg);
  transition: transform .18s ease;
  opacity: .9;
}
#elevenlabsHardWords[open] > summary::before {
  transform: translateY(-50%) rotate(45deg);
}
#elevenlabsHardWords > summary:hover {
  background: linear-gradient(0deg, rgba(255,255,255,0.05), rgba(255,255,255,0));
}
/* ==== LAYOUT: put sidebar section back to the original flex ==== */
.text-sidebar-layout{
  display: flex !important;              /* override the later grid rule */
  align-items: flex-start;
  gap: 24px;
  padding: 20px;
}
@media (max-width: 1100px){
  .text-sidebar-layout{ flex-direction: column; }
}

/* ==== TABS: readable text in Light theme (idle vs hover/active) ==== */
[data-theme='light'] .tab-item{
  color: #1e1e1e;                         /* idle/readable */
  background:
    linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,0)),
    #f6f7f9;
  border: 1px solid #d9d9e0;
}
[data-theme='light'] .tab-item .tab-label,
[data-theme='light'] .tab-item .tab-icon{
  color: inherit;
}
[data-theme='light'] .tab-item:hover,
[data-theme='light'] .tab-item.active{
  color:#fff !important;                  /* on gradient pills */
}
[data-theme='light'] .tab-item:hover{
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
  border-color: transparent;
}
[data-theme='light'] .tab-item.active{
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  border-color: transparent;
}

/* ==== SEARCH & REPLACE: pill/gradient buttons like in your screenshot ==== */
/* Keep inputs consistent in the card */
.search-replace-box .search-input{
  border-radius: 10px;
}

/* ================================
   FIXES: layout, buttons, tabs, checkboxes
   Place at END of styles.css
   ================================ */

/* 1) Restore the original two-column FLEX layout everywhere */
.text-sidebar-layout{ 
  display: flex !important; 
  align-items: flex-start; 
  gap: 24px; 
  padding: 20px;
}
#left-column{ flex: 1 1 auto; min-width: 0; }
#right-sidebar{ 
  flex: 0 0 280px; 
  position: -webkit-sticky; 
  position: sticky; 
  top: 0; 
  align-self: flex-start; 
}


/* 3) Tabs: readable text in light theme (only active/hover go white) */
[data-theme="light"] .tab-item:not(.active){
  color: var(--color-text-light) !important;      /* #1e1e1e per your tokens */
}
[data-theme="light"] .tab-item:not(.active) .tab-icon,
[data-theme="light"] .tab-item:not(.active) .tab-label{
  color: inherit !important;
}
/* Active/hover states can stay white as you designed */

/* 4) Modern, consistent checkboxes (site-wide) */
input[type="checkbox"]{
  /* keep native control for accessibility but match palette */
  accent-color: #6a11cb;               /* modern browsers */
}
/* Glass cards / light theme need a brighter box behind the checkmark */
[data-theme="light"] input[type="checkbox"]{
  background-color: #fff;
  border-color: #cfd3d9;
}

/* If you want the custom square checkboxes only inside glass panels: */
.search-replace-box input[type="checkbox"],
details > .exceptions-box input[type="checkbox"]{
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin: 0 8px 0 0;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.9);
  display: inline-grid; place-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.search-replace-box input[type="checkbox"]::after,
details > .exceptions-box input[type="checkbox"]::after{
  content: "";
  width: 10px; height: 10px; border-radius: 3px;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  transform: scale(0);
  transition: transform .12s ease;
}
.search-replace-box input[type="checkbox"]:checked::after,
details > .exceptions-box input[type="checkbox"]:checked::after{
  transform: scale(1);
}
/* Light theme tweak for those custom boxes */
[data-theme="light"] .search-replace-box input[type="checkbox"],
[data-theme="light"] details > .exceptions-box input[type="checkbox"]{
  background: #fff;
  border-color: #cfd3d9;
}

/* ==== 1) Restore original two-column FLEX layout (override later grid) ==== */
.text-sidebar-layout{
  display:flex !important;
  align-items:flex-start;
  gap:24px;
  padding:20px;
}
#left-column{ flex:1 1 auto; min-width:0; }
#right-sidebar{ flex:0 0 280px; }
@media (max-width:1100px){
  .text-sidebar-layout{ flex-direction:column; }
  #right-sidebar{ flex:1 1 auto; }
}

/* ==== 2) TABS — readable idle/hover/active in LIGHT theme ==== */
[data-theme="light"] .tab-item{
  color:#1e1e1e;                       /* readable */
  background:
    linear-gradient(180deg, rgba(0,0,0,.02), rgba(0,0,0,0)),
    #f5f7fb;                           /* subtle pill */
  border:1px solid #e4e6ef;
  box-shadow: 0 3px 8px rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.75);
}
[data-theme="light"] .tab-item:hover{
  color:#ffffff !important;
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
  border-color: transparent;
  box-shadow:0 8px 18px rgba(0,0,0,.12);
}
[data-theme="light"] .tab-item.active{
  color:#ffffff !important;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  border-color: transparent;
  box-shadow:0 10px 22px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.25);
}
[data-theme="light"] .tab-item .tab-label,
[data-theme="light"] .tab-item .tab-icon{ color:inherit !important; }

/* Search & Replace input tweaks */
.search-replace-box .search-input{ border-radius:10px; }

/* ==== 4) Modern checkboxes tuned for both themes ==== */
.search-replace-box input[type="checkbox"],
details > .exceptions-box input[type="checkbox"]{
  appearance:none;
  -webkit-appearance:none;
  width:18px; height:18px; margin:0 8px 0 0;
  border-radius:6px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(16,16,28,.55);
  display:inline-grid; place-content:center; vertical-align:middle;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.search-replace-box input[type="checkbox"]::after,
details > .exceptions-box input[type="checkbox"]::after{
  content:"";
  width:10px; height:10px; border-radius:3px;
  transform:scale(0);
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  transition:transform .12s ease;
}
.search-replace-box input[type="checkbox"]:checked::after,
details > .exceptions-box input[type="checkbox"]:checked::after{ transform:scale(1); }

/* Light theme checkbox surface */
[data-theme="light"] .search-replace-box input[type="checkbox"],
[data-theme="light"] details > .exceptions-box input[type="checkbox"]{
  background:#fff;
  border-color:#dadde6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

/* ==== 6) Small polish: hover state for top nav “tabs” in light mode ==== */
[data-theme="light"] .tabs-nav .tab-item:hover{ color:#fff !important; }

/* Search & Replace inputs – readable in Light */
[data-theme="light"] .search-replace-box input[type="text"],
[data-theme="light"] .search-replace-box input[type="search"],
[data-theme="light"] .search-replace-box input[type="number"],
[data-theme="light"] .search-replace-box textarea {
  background: #ffffff;
  color: #1e1e1e !important;
  border: 1px solid #d7d7e0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}

[data-theme="light"] .search-replace-box input::placeholder,
[data-theme="light"] .search-replace-box textarea::placeholder {
  color: #7a7a85;
}


/* Idle tab (non-active/hover) must be readable in Light */
[data-theme="light"] .tab-item{
  color:#1e1e1e; /* readable text */
  background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,0)),
              #eef2f7;
  border:1px solid #d9deea;
}

/* Ensure label+icon follow the color */
[data-theme="light"] .tab-item .tab-label,
[data-theme="light"] .tab-item .tab-icon{ color: inherit; }

/* Hover/Active use gradient pills, force white text */
[data-theme="light"] .tab-item:hover,
[data-theme="light"] .tab-item.active{
  color:#fff !important;
}
[data-theme="light"] .tab-item:hover .tab-label,
[data-theme="light"] .tab-item:hover .tab-icon,
[data-theme="light"] .tab-item.active .tab-label,
[data-theme="light"] .tab-item.active .tab-icon{
  color:#fff !important;
}

/* Base (Dark already looks fine) */
.search-replace-box input[type="checkbox"],
details > .exceptions-box input[type="checkbox"]{
  transition: background .15s, border-color .15s, box-shadow .15s;
}

/* Light theme checkbox look */
[data-theme="light"] .search-replace-box input[type="checkbox"],
[data-theme="light"] details > .exceptions-box input[type="checkbox"]{
  background:#ffffff;
  border:1px solid #cfd6e4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
[data-theme="light"] .search-replace-box input[type="checkbox"]::after,
[data-theme="light"] details > .exceptions-box input[type="checkbox"]::after{
  background: linear-gradient(135deg, #6a11cb, #2575fc); /* same pill gradient */
}

[data-theme="light"] .btn-primary:hover,
[data-theme="light"] .btn-gradient:hover{
  filter: brightness(1.05);
  color:#fff !important;
}

/* ===== AUTH MODAL ===== */
body.modal-open {
  overflow: hidden;
}
body.modal-open > *:not(#authModal) {
  pointer-events: none;
}
body.modal-open #authModal {
  display: flex;
}

#authModal {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
}

#authModal .modal-content {
  background: color-mix(in oklab, var(--color-bg-medium), transparent 20%);
  color: var(--color-text-light);
  border: 1px solid color-mix(in oklab, var(--color-text-light), transparent 85%);
  padding: 2rem 2.5rem;
  border-radius: 16px;
}

.modal .error {
  color: var(--color-error);
  margin-top: 10px;
  min-height: 1em;
}

/* Markers */
.marker:hover {
  transform: scale(1.2);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.hidden-marker {
  display: none;
}

/* ===== Inline style replacements ===== */
.inline-form {
  display: inline;
}

/* Width helper classes used in scripts and tests */
.layout-width-1200 { width: 1200px; }
.layout-width-800  { width: 800px; }
.layout-width-500  { width: 500px; }
.sidebar-width-280    { width: 280px; }
.sidebar-width-100pct { width: 100%; }

/* Tool-specific overrides */
.tool1 #processed-text {
  background: transparent;
}

