/* ============================================================================
   F5 Steganography - Application-specific styles
   Base styles inherited from PTE/main2m.css
   ============================================================================ */

/* ============================================================================
   PASSWORD SECTION
   ============================================================================ */

.password-section {
    margin-bottom: 8px;
}

.password-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    max-width: 24em;
}

.password-header label {
    font-weight: bold;
}

.header-actions {
    display: flex;
    gap: 4px;
}

.password-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    max-width: 24em;
}

.password-input-wrapper input {
    width: 100%;
    min-height: 22px;
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 6px 32px 6px 8px;
    box-sizing: border-box;
    border: 1px solid #969696;
    border-radius: 3px;
}

.btn-clear-password {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    font-size: 16px;
    color: #888;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.btn-clear-password:hover {
    color: #cc0000;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 80%;
}

.checkbox-row input[type="checkbox"] {
    margin: 0;
}

/* ============================================================================
   MODE TABS
   ============================================================================ */

.mode-tabs {
    display: flex;
    gap: 0;
    margin: 12px 0 0 0;
    border-bottom: none;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: bold;
    border: 1px solid #969696;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(to bottom, #f6f6f6 0%, #d7d7d7 100%);
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    max-width: 50%;
}

.tab-btn.active {
    background: #ffffff;
    color: #222;
    border-bottom: 1px solid #ffffff;
    margin-bottom: -1px;
    z-index: 1;
}

.tab-btn:hover:not(.active) {
    background: linear-gradient(to bottom, #ffffff 0%, #e8e8e8 100%);
}

/* ============================================================================
   PANELS
   ============================================================================ */

.panel {
    padding: 12px;
    border: 1px solid #969696;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #ffffff;
}

/* ============================================================================
   DATA TYPE TOGGLE
   ============================================================================ */

.data-type-toggle {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    padding: 6px 0;
}

.radio-label {
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.radio-label input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
}

/* ============================================================================
   TEXT AREA
   ============================================================================ */

#hideText, #revealText {
    font-size: 15px;
    padding: 8px;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
}

/* ============================================================================
   FILE INPUT
   ============================================================================ */

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.file-label {
    display: inline-block;
    cursor: pointer;
    margin-bottom: 6px;
}

.file-info {
    display: inline-block;
    font-size: 13px;
    color: #555;
    margin-left: 8px;
    word-break: break-all;
}

.file-drop-zone {
    min-height: 60px;
    padding: 16px;
}

.file-drop-zone.has-file p {
    display: none;
}

.file-drop-zone .file-info {
    display: none;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-left: 0;
}

.file-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f0f8f0;
    border: 1px solid #00BB00;
    border-radius: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.file-result span {
    font-weight: bold;
    word-break: break-all;
}

/* ============================================================================
   DROP ZONE / IMAGE AREA
   ============================================================================ */

.section-label {
    font-weight: bold;
    font-size: 14px;
    margin: 12px 0 6px 0;
    color: #333;
}

/* Always-visible carrier capacity readout (sits under the carrier image, outside Advanced Settings). */
.capacity-row {
    margin: 8px 0 4px 0;
    font-size: 14px;
    color: #333;
}
.capacity-row strong {
    color: #2e7d32;
}
/* Fit verdict (shown once a payload is staged): green when it fits, red when it doesn't. */
.capacity-row.capacity-fits {
    color: #2e7d32;
}
.capacity-row.capacity-exceeded,
.capacity-row.capacity-exceeded strong {
    color: #c62828;
}

.drop-zone {
    border: 2px dashed #888;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    transition: border-color 0.2s, background-color 0.2s;
    min-height: 80px;
    position: relative;
}

.drop-zone p {
    margin: 0;
    color: #888;
    font-size: 14px;
    pointer-events: none;
}

.drop-zone.drag-over {
    border-color: #00BB00;
    background: #f0fff0;
}

.drop-zone.has-image p {
    display: none;
}

.drop-zone .drop-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 6px;
}

.img-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    margin-top: 8px;
}

.result-preview {
    display: block;
    margin: 8px auto;
}

/* ============================================================================
   ADVANCED SETTINGS
   ============================================================================ */

.advanced-settings {
    margin: 12px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.advanced-settings summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    color: #444;
    user-select: none;
}

.advanced-settings summary:hover {
    color: #222;
}

.advanced-settings[open] summary {
    border-bottom: 1px solid #ddd;
}

.advanced-settings > *:not(summary) {
    padding: 0 14px;
}

/* ============================================================================
   QUALITY SLIDER
   ============================================================================ */

.quality-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    font-size: 14px;
}

.quality-slider {
    flex: 1;
    max-width: 200px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ccc;
    border-radius: 3px;
    outline: none;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #555;
    cursor: pointer;
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #555;
    cursor: pointer;
    border: none;
}

/* ============================================================================
   ALGORITHM SETTING
   ============================================================================ */

.setting-row {
    margin: 12px 0;
    font-size: 14px;
}

.setting-row > label {
    font-weight: bold;
    display: block;
    margin-bottom: 6px;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 4px;
}

.setting-hint {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
    line-height: 1.4;
}

/* ============================================================================
   RESIZE CONTROLS
   ============================================================================ */

.resize-section {
    margin: 8px 0 14px 0;
}

.resize-info {
    font-size: 13px;
    color: #555;
    margin: 8px 0;
}

.resize-mode-toggle {
    display: flex;
    gap: 16px;
    margin: 8px 0;
}

.resize-dims-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.resize-pct-row {
    margin: 8px 0;
}

.resize-input {
    width: 80px;
    padding: 4px 6px;
    font-size: 14px;
    border: 1px solid #969696;
    border-radius: 3px;
    box-sizing: border-box;
}

/* ============================================================================
   ACTION BUTTONS
   ============================================================================ */

.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    flex-wrap: wrap;
}

/* Override PTE button images with CSS-based indicators */
.downred-button,
.upgreen-button,
.erase-button {
    padding: 8px 20px !important;
    font-size: 15px !important;
    min-width: auto !important;
    height: auto !important;
    background-image: none !important;
    padding-left: 20px !important;
    touch-action: manipulation;
}

.downred-button {
    border-color: #CC0000 !important;
    color: #CC0000 !important;
    font-weight: bold;
}

.upgreen-button {
    border-color: #00AA00 !important;
    color: #00AA00 !important;
    font-weight: bold;
}

.erase-button {
    border-color: #AA6600 !important;
    color: #AA6600 !important;
}

/* ============================================================================
   RESULT SECTIONS
   ============================================================================ */

.result-section {
    margin-top: 12px;
    padding: 12px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ============================================================================
   STATUS MESSAGE
   ============================================================================ */

.status-msg {
    margin: 12px 0;
    padding: 10px 14px;
    background: #fff8e0;
    border: 1px solid #e0c050;
    border-radius: 4px;
    font-size: 14px;
    color: #665500;
}

/* ============================================================================
   SECURE FILE SAVE DIALOG (.stego-modal)
   Shown before saving a revealed file steganogram.
   ============================================================================ */

.stego-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
}

.stego-modal__box {
    background: #ffffff;
    border-radius: 8px;
    border-top: 4px solid #00AA00;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 22px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}

.stego-modal__title {
    /* Reset the gray gradient bar / border / padding inherited from the
       base PTE stylesheet's h2 rule — the modal title should be plain text. */
    margin: 0 0 14px;
    padding: 0 0 12px;
    border: none;
    border-bottom: 1px solid #e2e2e2;
    background: none;
    background-image: none;
    box-shadow: none;
    border-radius: 0;
    text-align: left;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.3;
    color: #222;
    width: auto;
}

.stego-modal__row {
    display: flex;
    gap: 8px;
    padding: 5px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.stego-modal__label {
    flex: 0 0 110px;
    color: #666;
    font-weight: bold;
}

.stego-modal__value {
    flex: 1 1 auto;
    color: #222;
    word-break: break-word;
}

.stego-modal__fingerprint {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    white-space: pre;
    font-size: 12.5px;
    line-height: 1.45;
    letter-spacing: 0.5px;
}

.stego-modal__notice {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1.45;
}

.stego-modal__notice--low {
    background: #fff8e0;
    border: 1px solid #e0c050;
    color: #5a4a00;
}

.stego-modal__notice--high {
    background: #ffe6e6;
    border: 1px solid #dd8888;
    color: #8a1f1f;
    font-weight: 500;
}

.stego-modal__buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.stego-modal__btn {
    padding: 9px 18px;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #bbb;
    background: #f2f2f2;
    color: #333;
    cursor: pointer;
    touch-action: manipulation;
}

.stego-modal__btn:hover {
    filter: brightness(0.97);
}

.stego-modal__btn--cancel {
    border-color: #999;
}

.stego-modal__btn--save {
    border-color: #00AA00;
    color: #00AA00;
    font-weight: bold;
}

.stego-modal__btn--danger {
    border-color: #CC0000;
    background: #CC0000;
    color: #ffffff;
    font-weight: bold;
}

@media screen and (max-width: 600px) {
    .stego-modal__box {
        padding: 16px;
    }
    .stego-modal__label {
        flex-basis: 90px;
    }
    .stego-modal__buttons {
        flex-direction: column-reverse;
    }
    .stego-modal__btn {
        width: 100%;
    }
    .stego-modal__fingerprint {
        font-size: 11.5px;
    }
}

/* ============================================================================
   MOBILE OPTIMIZATIONS
   ============================================================================ */

@media screen and (max-width: 600px) {
    body {
        margin-left: 0.4em;
        margin-right: 4px;
    }

    .drop-zone {
        padding: 16px 12px;
    }

    .img-preview {
        max-height: 200px;
    }

    .action-row button {
        flex: 1;
        min-width: 0;
    }

    .quality-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .quality-slider {
        max-width: 100%;
        width: 100%;
    }

    #hideText, #revealText {
        height: 8em !important;
    }

    .tab-btn {
        padding: 12px 8px;
        font-size: 16px;
    }

    .resize-dims-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .resize-input {
        width: 100%;
        max-width: 120px;
    }
}

/* Prevent iOS zoom on input focus */
@media screen and (max-width: 600px) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* ============================================================================
   GENERAL OVERRIDES for PTE base CSS compatibility
   ============================================================================ */

main {
    max-width: 100%;
}

/* Fix heading widths inherited from PTE */
h1.asH2, h2, div.gradient {
    margin-right: -8px;
}
