/* Base Styles */
html, body {
    min-height: 100vh;
    margin: 0; padding: 0;
    box-sizing: border-box;
    width: 100vw;
    font-family: "Inter", "Vazirmatn", Arial, sans-serif;
    direction: rtl;
    color: #343a40; /* Dark charcoal text */
    display: flex;
    flex-direction: column;
    position: relative; /* برای قرار دادن گرادیان پس‌زمینه */
    overflow-x: hidden; /* جلوگیری از اسکرول افقی */
}

/* Gradient Background */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0f7fa 0%, #ffffff 100%); /* Soft, calming blue gradient fading to white */
    z-index: -1; /* قرار گرفتن در پشت محتوا */
}

.container {
    max-width: 900px; /* کمی عریض‌تر */
    min-width: 340px;
    margin: 30px auto 20px auto; /* فضای کمتر عمودی */
    background: #ffffff; /* Pure white container */
    border-radius: 25px; /* گوشه‌های بسیار گردتر */
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.1); /* سایه عمیق‌تر و نرم‌تر */
    padding: 2.8em; /* پدینگ کمتر */
    display: flex;
    flex-direction: column;
    gap: 35px; /* فاصله کمتر بین بخش‌ها */
    position: relative; /* برای z-index بالای گرادیان */
    z-index: 1;
}

.app-title {
    text-align: center;
    font-size: 2.2em; /* عنوان کمی کوچکتر */
    font-weight: 700; /* کمی کمتر بولد */
    letter-spacing: 0.02em; /* فاصله بیشتر بین حروف */
    user-select: none;
    margin-bottom: 20px; /* مارجین کمتر */
    color: #343a40; /* Solid dark text color - matching reference image */
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Subtle text shadow */
}

/* Input and Output sections are now just logical groupings within the main container, not separate cards */
.input-section, .output-section {
    padding: 0; /* No explicit padding, rely on container padding */
    border: none; /* No borders */
    box-shadow: none; /* No shadows */
    background: transparent; /* Transparent background */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Spacing between elements within section */
}

.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px; /* فاصله بیشتر زیر هدر */
}

label {
    font-weight: 600; /* پررنگ‌تر */
    color: #495057;
    font-size: 1.15em; /* فونت بزرگ‌تر برای لیبل */
    user-select: none;
    letter-spacing: 0.01em;
    text-align: right;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* فاصله بیشتر بین آیکون و متن */
    color: #fff;
    font-size: 1.05em; /* فونت کمی کوچکتر برای دکمه‌ها */
    padding: 15px 30px; /* پدینگ کمی کمتر برای دکمه‌ها */
    border-radius: 30px; /* دکمه‌های کاملاً گرد */
    border: none;
    cursor: pointer;
    font-weight: 600; /* پررنگ‌تر */
    letter-spacing: 0.03em; /* فاصله بیشتر بین حروف */
    min-width: 180px; /* دکمه‌های کمی باریک‌تر */
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); /* انیمیشن روان‌تر */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* سایه پیش‌فرض نرم */
    position: relative;
    overflow: hidden; /* برای افکت موجی */
}

.btn:hover {
    transform: translateY(-3px); /* حرکت به سمت بالا در هاور */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); /* سایه قوی‌تر در هاور */
}

.btn:active {
    transform: translateY(0); /* بازگشت به حالت عادی در کلیک */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08); /* سایه کمتر در کلیک */
}

.btn:disabled {
    background: #e0e0e0 !important;
    color: #a0a0a0 !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.7;
}

/* Specific Button Styles with Subtle Gradients */
.btn-primary {
    background: linear-gradient(180deg, #007bff 0%, #0056b3 100%); /* Blue gradient */
}
.btn-primary:hover {
    background: linear-gradient(180deg, #0056b3 0%, #004085 100%);
}
.btn-success {
    background: linear-gradient(180deg, #28a745 0%, #1e7e34 100%); /* Green gradient */
}
.btn-success:hover {
    background: linear-gradient(180deg, #1e7e34 0%, #155724 100%);
}
.btn-secondary {
    background: linear-gradient(180deg, #6c757d 0%, #5a6268 100%); /* Gray gradient */
}
.btn-secondary:hover {
    background: linear-gradient(180deg, #5a6268 0%, #495057 100%);
}
.btn-info { /* Used for single copy buttons */
    background: linear-gradient(180deg, #17a2b8 0%, #138496 100%); /* Teal gradient */
}
.btn-info:hover {
    background: linear-gradient(180deg, #138496 0%, #117a8b 100%);
}
.btn-clear { /* Adjusted for smaller clear buttons */
    background: linear-gradient(180deg, #dc3545 0%, #c82333 100%); /* Red gradient */
    padding: 8px 16px; /* Smaller padding */
    border-radius: 6px; /* Less rounded */
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1); /* Subtler shadow */
    font-size: 0.9em; /* Smaller font */
    min-width: unset; /* Allow shrinking */
    width: auto; /* Auto width */
}
.btn-clear:hover {
    background: linear-gradient(180deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 3px 10px rgba(220, 53, 69, 0.15);
}

.btn-clear-kv { /* New style for KV clear button */
    background: linear-gradient(180deg, #ffc107 0%, #e0a800 100%); /* Warning yellow gradient */
    color: #343a40; /* Dark text for contrast */
    padding: 10px 20px; /* Smaller padding */
    border-radius: 8px; /* Less rounded */
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
    font-weight: 600;
    margin-top: 25px; /* Space from other buttons */
    align-self: flex-start; /* Align to the left (in RTL) */
    font-size: 0.95em; /* Smaller font */
    min-width: unset;
    width: auto;
}
.btn-clear-kv:hover {
    background: linear-gradient(180deg, #e0a800 0%, #c69500 100%);
    box-shadow: 0 3px 10px rgba(255, 193, 7, 0.25);
}


textarea {
    width: 100%;
    font-family: "Fira Mono", consolas, monospace;
    font-size: 16px; /* فونت کمی بزرگ‌تر */
    min-height: 160px; /* ارتفاع پیش‌فرض بیشتر */
    resize: vertical;
    border: 1px solid #e0e0e0; /* Very light, clean border */
    border-radius: 10px; /* گوشه‌های گردتر */
    box-sizing: border-box;
    padding: 18px 20px; /* پدینگ بیشتر */
    background: #ffffff;
    color: #343a40;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.05); /* Subtle inner shadow */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    direction: ltr;
    text-align: left;
    margin-top: 8px; /* فاصله بیشتر از لیبل */
    user-select: text;
}
textarea:focus {
    border-color: #007bff; /* Primary blue focus */
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(0, 123, 255, 0.1); /* Softer focus ring */
}

.main-btns, .output-controls {
    width: 100%;
    display: flex;
    gap: 25px; /* فاصله بیشتر بین دکمه‌ها */
    justify-content: center;
    margin-top: 35px; /* مارجین بیشتر */
    user-select: none;
    flex-wrap: wrap;
}

.info-box {
    font-size: 16px; /* فونت بزرگ‌تر */
    margin: 25px 0 0 0; /* مارجین بیشتر */
    text-align: center;
    letter-spacing: 0.01em;
    min-height: 20px;
    user-select: none;
    padding: 18px 30px; /* پدینگ بیشتر */
    border-radius: 14px; /* گوشه‌های گردتر */
    border: 1px solid;
    transition: all 0.4s ease, opacity 0.6s ease; /* انیمیشن روان‌تر */
    visibility: hidden; /* Hidden by default, shown by JS */
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px; /* فاصله برای آیکون */
    font-weight: 600;
}
.info-box.show {
    visibility: visible;
    opacity: 1;
}
.info-box.success {
    background-color: #d4edda; /* سبز روشن */
    color: #155724; /* سبز تیره */
    border-color: #c3e6cb;
}
.info-box.error {
    background-color: #f8d7da; /* قرمز روشن */
    color: #721c24; /* قرمز تیره */
    border-color: #f5c6cb;
}
.info-box.info {
    background-color: #e2f0fe; /* آبی روشن */
    color: #007bff; /* آبی اصلی */
    border-color: #b3d7ff;
}

/* Summary Card Styles */
.summary-card {
    background: #f8f9fa; /* Light grey background */
    border-radius: 20px; /* Rounded corners */
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03); /* Subtle inner shadow */
    padding: 0.7em 1.2em; /* Reduced padding further */
    margin-top: 10px; /* Reduced margin-top further */
    border: 1px solid #e9ecef; /* Very light border */
}

.summary-card h3 {
    text-align: center;
    font-size: 1.1em; /* Reduced font size further */
    color: #007bff; /* Primary blue */
    margin-bottom: 8px; /* Reduced margin further */
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; /* Reduced gap further */
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Adjusted minmax for smaller items */
    gap: 8px; /* Reduced spacing further */
    margin-bottom: 8px; /* Reduced margin further */
}

.summary-item {
    background: #ffffff; /* White background for each item */
    border-radius: 8px; /* Reduced rounded corners further */
    padding: 8px; /* Reduced padding inside items further */
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.03); /* Reduced shadow further */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #f0f0f0; /* Very light border */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-item:hover {
    transform: translateY(-1px); /* Reduced movement */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Reduced shadow further */
}

.summary-item span:first-child {
    font-size: 0.8em; /* Reduced font size further */
    color: #6c757d; /* Grey text for labels */
    margin-bottom: 2px; /* Reduced margin further */
    font-weight: 500;
}

.summary-item span:last-child {
    font-size: 1.4em; /* Reduced font size further */
    font-weight: 700; /* Bold numbers */
    color: #343a40; /* Dark charcoal for numbers */
}

.summary-protocol-counts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px; /* Reduced gap further */
    padding-top: 6px; /* Reduced padding further */
    border-top: 1px solid #e9ecef; /* Separator line */
}

.summary-protocol-counts div {
    background: #e9f5ff; /* Light blue background for protocol items */
    color: #007bff;
    padding: 5px 10px; /* Reduced padding further */
    border-radius: 12px; /* Pill-shaped further */
    font-size: 0.75em; /* Reduced font size further */
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 123, 255, 0.06); /* Reduced shadow further */
    transition: background-color 0.2s ease;
}

.summary-protocol-counts div:hover {
    background-color: #d4edff;
}


footer {
    width: 100vw;
    background: #2c3e50; /* رنگ تیره و حرفه‌ای برای فوتر */
    color: #ecf0f1; /* متن روشن برای کنتراست */
    font-family: "Inter", Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.03em;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 22px 0; /* پدینگ بیشتر */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    direction: ltr;
    position: relative;
    margin-top: auto;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.08); /* سایه ظریف در بالای فوتر */
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.75); /* پوشش تیره و مات‌تر */
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.4s ease; /* انیمیشن روان‌تر */
}
.modal.show {
    visibility: visible;
    opacity: 1;
}
.modal-content {
    background-color: #fefefe;
    padding: 35px 45px; /* پدینگ بیشتر */
    border-radius: 20px; /* گوشه‌های بسیار گرد */
    max-width: 550px; /* مدال عریض‌تر */
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 70px rgba(0,0,0,0.4); /* سایه بسیار قوی‌تر */
    border-top: 8px solid #ffc107; /* مرز بالای ضخیم‌تر و زرد هشدار */
}
.modal-close {
    color: #777;
    position: absolute;
    top: 18px; /* موقعیت تنظیم شده */
    right: 22px; /* موقعیت تنظیم شده */
    font-size: 36px; /* آیکون بستن بزرگ‌تر */
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}
.modal-close:hover,
.modal-close:focus {
    color: #333;
    text-decoration: none;
}
.modal-message {
    margin: 30px 0; /* مارجین بیشتر */
    font-size: 1.35em; /* فونت پیام بزرگ‌تر */
    color: #333;
    line-height: 1.7; /* ارتفاع خط بیشتر */
    font-weight: 500;
}
.modal-button {
    color: white;
    border: none;
    padding: 14px 28px; /* پدینگ بیشتر */
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 18px; /* فونت بزرگ‌تر */
    margin: 12px 10px; /* مارجین بیشتر */
    cursor: pointer;
    border-radius: 12px; /* گوشه‌های گردتر */
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.modal-button.confirm-button { background-color: #28a745; }
.modal-button.confirm-button:hover { background-color: #218838; }
.modal-button.cancel-button { background-color: #dc3545; }
.modal-button.cancel-button:hover { background-color: #c82333; }
.modal-button.ok-button { background-color: #007bff; }
.modal-button.ok-button:hover { background-color: #0056b3; }

/* Loading spinner for buttons */
.loading {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 22px; /* اسپینر بزرگ‌تر */
    height: 22px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Styles for individual config items in output */
.config-list-container {
    margin-top: 20px; /* مارجین بیشتر */
    border: 1px solid #e9ecef; /* Light border around the list */
    border-radius: 16px; /* گوشه‌های بسیار گرد */
    padding: 20px; /* پدینگ بیشتر */
    background: #fdfdfd; /* پس‌زمینه بسیار روشن */
    /* Removed min-height and overflow-y: auto to allow main page scroll */
    max-height: unset; /* Ensure it doesn't limit height */
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03); /* سایه داخلی عمیق‌تر */
}
.config-list-container .empty-message {
    text-align: center;
    color: #6c757d;
    padding: 40px; /* پدینگ بیشتر */
    font-style: italic;
    font-size: 1.2em; /* فونت بزرگ‌تر */
    font-weight: 500;
}

/* New styles for grouped config display */
.protocol-group {
    background: #ffffff;
    border-radius: 18px; /* Slightly more rounded than inner items */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); /* More prominent shadow for groups */
    margin-bottom: 30px; /* Space between groups */
    overflow: hidden; /* Ensure rounded corners are respected */
    border: 1px solid #e0e0e0;
}

.protocol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px; /* Generous padding */
    background: linear-gradient(90deg, #f0f8ff 0%, #ffffff 100%); /* Light gradient for header */
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    user-select: none;
    font-size: 1.3em;
    font-weight: 700;
    color: #007bff; /* Primary blue for header text */
    transition: background 0.3s ease;
}

.protocol-header:hover {
    background: linear-gradient(90deg, #e6f3ff 0%, #ffffff 100%);
}

.protocol-header .protocol-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.protocol-header .protocol-count {
    background: #007bff;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.protocol-header .toggle-icon {
    transition: transform 0.3s ease;
}

.protocol-header.expanded .toggle-icon {
    transform: rotate(90deg); /* Rotate icon when expanded */
}

.protocol-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out; /* Smooth collapse/expand */
    padding: 0 30px; /* Padding for content inside */
}

.protocol-content.expanded {
    max-height: 10000px; /* Large enough value to show all content */
    padding-bottom: 20px; /* Add padding when expanded */
}

.protocol-batch {
    background: #fdfdfd; /* Lighter background for batches */
    border-radius: 12px;
    padding: 15px 20px;
    margin-top: 20px; /* Space between batches */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03); /* Subtle shadow for batches */
    border: 1px solid #f5f5f5;
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 600;
    color: #495057;
    font-size: 1em;
}

.batch-configs-textarea { /* Single textarea for batch */
    width: 100%;
    font-family: "Fira Mono", consolas, monospace;
    font-size: 14px; /* Slightly smaller for batch content */
    min-height: 100px; /* Minimum height for batch textarea */
    resize: vertical;
    border: 1px solid #e9ecef; /* Lighter border */
    border-radius: 8px; /* Slightly less rounded */
    box-sizing: border-box;
    padding: 12px 15px;
    background: #ffffff;
    color: #343a40;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    direction: ltr;
    text-align: left;
    user-select: text;
    line-height: 1.4; /* More readable line height */
}
.batch-configs-textarea:focus {
    border-color: #007bff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03), 0 0 0 2px rgba(0, 123, 255, 0.08);
}


.protocol-group-controls {
    display: flex;
    justify-content: flex-end; /* Align buttons to the left (in RTL) */
    gap: 15px;
    padding: 15px 30px 20px 30px; /* Padding inside the footer of the group */
    border-top: 1px solid #f0f0f0;
    margin-top: 20px;
}
.protocol-group-controls .btn {
    min-width: unset;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 25px; /* More rounded for these buttons */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.protocol-group-controls .btn:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}


/* Responsive adjustments */
@media (max-width: 950px) {
    .container { max-width: 98vw; padding: 2.5em; margin: 40px auto; }
    .app-title { font-size: 2.5em; }
    .row-header { margin-bottom: 10px; }
    label { font-size: 1.1em; }
    textarea { font-size: 14px; min-height: 140px; padding: 15px; }
    .main-btns, .output-controls { gap: 20px; margin-top: 30px; }
    .btn { padding: 14px 28px; min-width: 160px; font-size: 1.05em; }
    .info-box { padding: 15px 25px; font-size: 15px; }
    .summary-card { padding: 0.8em 1.5em; } /* Adjusted */
    .summary-card h3 { font-size: 1.2em; margin-bottom: 10px; } /* Adjusted */
    .summary-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; } /* Adjusted */
    .summary-item { padding: 10px; border-radius: 10px; } /* Adjusted */
    .summary-item span:first-child { font-size: 0.85em; margin-bottom: 3px; } /* Adjusted */
    .summary-item span:last-child { font-size: 1.6em; } /* Adjusted */
    .summary-protocol-counts div { padding: 6px 12px; font-size: 0.8em; } /* Adjusted */
    .config-list-container { padding: 18px; }
    .protocol-header { padding: 18px 25px; font-size: 1.2em; }
    .protocol-content { padding: 0 25px; }
    .protocol-batch { padding: 12px 18px; margin-top: 15px; }
    .batch-configs-textarea { font-size: 13px; min-height: 80px; padding: 10px 12px; }
    .protocol-group-controls { padding: 12px 25px 18px 25px; gap: 10px; margin-top: 15px; }
    .protocol-group-controls .btn { padding: 10px 20px; font-size: 0.95em; min-width: unset; }
    .btn-clear { padding: 6px 12px; font-size: 0.85em; }
    .btn-clear-kv { padding: 8px 16px; font-size: 0.9em; }
}

@media (max-width: 650px) {
    .container { max-width: 100vw; border-radius: 0; padding: 1.5em 1em; gap: 30px; margin: 0 auto; }
    .app-title { font-size: 2.2em; margin-bottom: 25px; }
    label { font-size: 1em; }
    textarea { font-size: 13px; min-height: 100px; padding: 10px; }
    .main-btns { flex-direction: column; gap: 15px; margin-top: 25px; }
    .btn { padding: 12px 25px; min-width: unset; width: 100%; font-size: 1em; }
    .output-controls { gap: 15px; margin-top: 25px; flex-direction: column; }
    .output-controls .btn { padding: 10px 28px; font-size: 1em; width: 100%; }
    .info-box { font-size: 14px; padding: 12px 20px; }
    .summary-card { padding: 0.8em 1em; } /* Adjusted */
    .summary-card h3 { font-size: 1.1em; margin-bottom: 8px; } /* Adjusted */
    .summary-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 8px; } /* Single column on small mobile, adjusted gap */
    .summary-item { padding: 8px; border-radius: 8px; } /* Adjusted */
    .summary-item span:first-child { font-size: 0.8em; margin-bottom: 2px; } /* Adjusted */
    .summary-item span:last-child { font-size: 1.4em; } /* Adjusted */
    .summary-protocol-counts div { padding: 5px 10px; font-size: 0.75em; } /* Adjusted */
    .config-list-container { padding: 15px; }
    .protocol-header { padding: 15px 20px; font-size: 1.1em; }
    .protocol-content { padding: 0 20px; }
    .protocol-batch { padding: 10px 15px; margin-top: 10px; }
    .batch-configs-textarea { font-size: 12px; min-height: 60px; padding: 8px 10px; }
    .protocol-group-controls { flex-direction: column; gap: 8px; padding: 10px 20px 15px 20px; margin-top: 10px; }
    .protocol-group-controls .btn { width: 100%; padding: 10px 20px; font-size: 0.9em; }
    footer { font-size: 13px; padding: 18px 0; }
    .modal-content { padding: 20px 25px; border-radius: 12px; }
    .modal-message { font-size: 1.1em; margin: 20px 0; }
    .modal-button { padding: 10px 20px; font-size: 15px; margin: 8px 6px; }
    .btn-clear { padding: 6px 12px; font-size: 0.85em; }
    .btn-clear-kv { padding: 8px 16px; font-size: 0.9em; }
}

@media (max-width: 480px) {
    .container { padding: 1em 0.8em; }
    .app-title { font-size: 2em; margin-bottom: 18px; }
    textarea { font-size: 12px; min-height: 80px; }
    .info-box { font-size: 13px; padding: 12px 18px; }
    .row-header { flex-direction: column; align-items: flex-end; gap: 8px; } /* Stack label and clear button */
    .btn-clear { width: 100%; } /* Make clear button full width on small screens */
    .btn-clear-kv { width: 100%; align-self: center; } /* Center on very small screens */
    .config-list-container { padding: 10px; }
    .protocol-header { font-size: 1em; padding: 12px 15px; }
    .protocol-content { padding: 0 15px; }
    .protocol-batch { padding: 8px 10px; margin-top: 8px; }
    .batch-configs-textarea { font-size: 11px; min-height: 40px; padding: 6px 8px; }
    .protocol-group-controls { padding: 8px 15px 12px 15px; }
    .modal-content { padding: 15px 20px; }
    .modal-message { font-size: 1em; margin: 15px 0; }
    .modal-button { padding: 8px 15px; font-size: 14px; margin: 6px 4px; }
}
