/* ============================================================
   Hash Generator & Verifier — Application-Specific Styles
   Inherits base styles from main2e.css
   ============================================================ */

/* --- Input Tabs --- */
.hash-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid #AAAAAA;
}

.hash-tab {
    flex: 1;
    padding: 10px 18px;
    border: 1px solid #AAAAAA;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #e8e8e8;
    background-image: linear-gradient(to bottom, #f6f6f6 0%, #d7d7d7 100%);
    font-size: 15px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    margin-right: 2px;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.hash-tab:last-child {
    margin-right: 0;
}

.hash-tab.active {
    background: #ffffff;
    background-image: none;
    color: #098572;
    border-bottom: 2px solid #ffffff;
    margin-bottom: -2px;
    position: relative;
    z-index: 1;
}

.hash-tab:not(.active):hover {
    background: #f0f0f0;
    color: #333;
}

.hash-panel {
    padding: 12px 10px 10px;
    border: 1px solid #AAAAAA;
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-bottom: 4px;
}

/* --- Encoding selector --- */
.encoding-row {
    margin-top: 6px;
    font-size: 85%;
    color: #555;
}

.encoding-row select {
    border: 1px solid #aaa;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 13px;
    background: #fff;
}

/* --- Text Input --- */
#textInput {
    padding: 8px 10px;
    box-sizing: border-box;
    font-family: arial, sans-serif;
    font-size: 14px;
    resize: vertical;
}

/* --- Drop Zone --- */
.drop-zone {
    position: relative;
    border: 2px dashed #098572;
    border-radius: 8px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #f8fffd;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #06634f;
    background: #e8fff7;
}

.drop-zone.drag-over {
    border-style: solid;
    box-shadow: inset 0 0 20px rgba(9,133,114,0.10);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    margin-bottom: 4px;
}

.drop-text-primary {
    font-weight: bold;
    color: #098572;
    margin: 6px 0 2px;
    font-size: 15px;
}

.drop-text-secondary {
    color: #888;
    font-size: 13px;
    margin: 0;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* --- File Info --- */
.file-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    background: #f0faf7;
    border: 1px solid #b0ddd4;
    border-radius: 4px;
    font-size: 14px;
}

#fileName {
    font-weight: bold;
    color: #098572;
    word-break: break-all;
}

#fileSize {
    color: #666;
    font-size: 13px;
}

.btn-sm {
    padding: 3px 10px !important;
    font-size: 12px !important;
    min-width: auto !important;
    height: auto !important;
}

/* --- Progress Bar --- */
.file-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #098572, #0bb89e);
    border-radius: 4px;
    transition: width 0.15s;
}

#progressText {
    font-size: 12px;
    color: #555;
    min-width: 36px;
    text-align: right;
}

/* --- Algorithm Selection --- */
.algo-details {
    margin: 12px 0 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0;
}

.algo-details summary {
    padding: 8px 12px;
    cursor: pointer;
    background: #f6f6f6;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.algo-details summary span {
    font-weight: normal;
    color: #888;
    font-size: 13px;
}

.algo-details[open] summary {
    border-bottom: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
}

.algo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 2px 12px;
    padding: 8px 12px 4px;
}

.algo-grid label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    padding: 4px 2px;
    cursor: pointer;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.algo-grid label:hover {
    color: #098572;
}

.algo-grid input[type="checkbox"] {
    accent-color: #098572;
    width: 15px;
    height: 15px;
    min-width: 15px;
    cursor: pointer;
}

.algo-label-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.algo-bits {
    font-size: 11px;
    color: #999;
}

.algo-group-label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-top: 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid #eee;
}

.algo-group-label:first-child {
    margin-top: 0;
}

.algo-presets {
    padding: 4px 12px 8px;
    display: flex;
    gap: 6px;
}

/* --- Hash Results Table --- */
.hash-results {
    margin: 10px 0;
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

#resultsTable thead th {
    text-align: left;
    padding: 6px 8px;
    background: #f0f0f0;
    border-bottom: 2px solid #aaa;
    font-size: 13px;
    color: #555;
}

.col-algo {
    width: 105px;
}

.col-action {
    width: 46px;
}

#resultsTable tbody tr {
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.1s;
}

#resultsTable tbody tr:hover {
    background: #f8fffd;
}

#resultsTable tbody tr.match-yes {
    background: #e6ffe6;
}

#resultsTable tbody tr.match-no {
    background: #fff8f0;
}

#resultsTable td {
    padding: 5px 8px;
    vertical-align: middle;
}

.algo-name {
    font-weight: bold;
    font-size: 12px;
    color: #098572;
    white-space: nowrap;
}

.algo-name.legacy {
    color: #b07020;
}

.hash-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11.5px;
    word-break: break-all;
    color: #333;
    line-height: 1.4;
    user-select: all;
    -webkit-user-select: all;
}

.hash-value.computing {
    color: #999;
    font-style: italic;
    font-family: arial, sans-serif;
    font-size: 12px;
}

.copy-btn {
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f8f8f8;
    padding: 3px 7px;
    font-size: 11px;
    cursor: pointer;
    color: #555;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover {
    border-color: #FFAA00;
    background: #fffaf0;
}

.copy-btn:active {
    background: #eee;
}

.copy-btn.copied {
    border-color: #098572;
    color: #098572;
    background: #f0faf7;
}

.empty-state {
    text-align: center;
    padding: 24px 16px;
    color: #999;
    font-size: 14px;
}

/* --- Compare Section --- */
.compare-section {
    margin-top: 0;
}

.compare-inner {
    padding: 0 0 8px;
}

.compare-inner label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #555;
}

.compare-inner input[type="text"] {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    padding: 6px 8px;
    border: 2px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.compare-inner input[type="text"]:focus {
    border-color: #098572;
    outline: none;
}

.compare-result {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}

.compare-result.match {
    background: #e6ffe6;
    border: 1px solid #4CAF50;
    color: #2e7d32;
}

.compare-result.no-match {
    background: #fff3e0;
    border: 1px solid #FF9800;
    color: #e65100;
}

.compare-result.no-match-any {
    background: #fce4ec;
    border: 1px solid #e57373;
    color: #c62828;
}

/* --- Self-test --- */
.self-test-result {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
	width: fit-content;
}

.self-test-result.pass {
    background: #e8f5e9;
    border-color: #4CAF50;
    color: #2e7d32;
}

.self-test-result.fail {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.test-log {
    font-size: 11px;
    font-family: 'Courier New', Courier, monospace;
    background: #fafafa;
    border: 1px solid #ddd;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    margin: 0;
}

/* --- Mobile Optimizations --- */
@media (max-width: 600px) {
    .hash-tab {
        padding: 10px 10px;
        font-size: 14px;
    }

    .algo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1px 8px;
        padding: 6px 8px 4px;
    }

    .algo-grid label {
        font-size: 12px;
        padding: 3px 1px;
        gap: 4px;
    }

    .algo-grid input[type="checkbox"] {
        width: 14px;
        height: 14px;
        min-width: 14px;
    }

    .algo-bits {
        font-size: 10px;
    }

    .col-algo {
        width: 80px;
    }

    .col-action {
        width: 40px;
    }

    .algo-name {
        font-size: 11px;
    }

    .hash-value {
        font-size: 10.5px;
    }

    #resultsTable td {
        padding: 5px 4px;
    }

    .drop-zone {
        padding: 24px 12px;
        min-height: 80px;
    }

    .compare-inner input[type="text"] {
        font-size: 12px;
    }

    .copy-btn {
        padding: 4px 6px;
        font-size: 10px;
    }
}

@media (max-width: 400px) {
    .algo-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 0px 6px;
    }

    .algo-grid label {
        font-size: 11px;
        padding: 3px 0;
        gap: 3px;
    }

    .algo-grid input[type="checkbox"] {
        width: 13px;
        height: 13px;
        min-width: 13px;
    }

    .algo-bits {
        font-size: 9px;
    }
}

/* Touch device: larger tap targets */
@media (pointer: coarse) {
    .algo-grid label {
        padding: 5px 2px;
    }

    .algo-grid input[type="checkbox"] {
        width: 18px;
        height: 18px;
        min-width: 18px;
    }

    .copy-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .hash-tab {
        padding: 12px 10px;
    }
}

/* Upper-case toggle for hash display */
.hash-value.uppercase {
    text-transform: uppercase;
}

/* Screen-reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* No-algorithm warning */
.no-algo-warning {
    background: #3d3000;
    border: 1px solid #665200;
    color: #ffd700;
    padding: 12px 16px;
    border-radius: 6px;
    text-align: center;
    margin: 12px 0;
    font-size: 14px;
}

/* Large file warning */
.large-file-warning {
    background: #3d3000;
    border: 1px solid #665200;
    color: #ffcc00;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin: 8px 0 0 0;
}

/* Progress label */
#progressLabel {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 2px;
    display: block;
}

/* ---- Privacy Banner ---- */
.privacy-banner {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: linear-gradient(135deg, #e8f5f0 0%, #f0faf6 100%);
    border: 1px solid #b2dfcf;
    border-radius: var(--radius-md);
    padding: 0.55em 0.7em;
    margin-bottom: 0.8em;
	margin-left: auto;
	margin-right: auto;
    font-size: 85%;
    color: var(--pw-teal-dark);
    line-height: 1.35;
	max-width: 640px;
}

.privacy-banner .shield-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
}
