/* ========================================
   Integrity - Tool Specific Styles
   ======================================== */

/* ----------------------------------------
   Hash Tool
   ---------------------------------------- */
.hash-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hash-result-item {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
}

/* ----------------------------------------
   Compare Tool
   ---------------------------------------- */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

@media (max-width: 768px) {
    .compare-grid {
        grid-template-columns: 1fr;
    }
}

.compare-result {
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    text-align: center;
}

.compare-result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-result-icon svg {
    width: 32px;
    height: 32px;
}

.compare-result.match {
    background-color: var(--accent-light);
    border: 1px solid var(--accent);
}

.compare-result.match .compare-result-icon {
    background-color: rgba(34, 197, 94, 0.2);
    color: var(--accent);
}

.compare-result.match .compare-result-title {
    color: var(--accent);
}

.compare-result.mismatch {
    background-color: var(--error-light);
    border: 1px solid var(--error);
}

.compare-result.mismatch .compare-result-icon {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.compare-result.mismatch .compare-result-title {
    color: var(--error);
}

.compare-result-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.compare-result-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ----------------------------------------
   JSON Tool
   ---------------------------------------- */
.json-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 768px) {
    .json-editor {
        grid-template-columns: 1fr;
    }
}

.json-panel {
    display: flex;
    flex-direction: column;
}

.json-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.json-panel-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.json-textarea {
    flex: 1;
    min-height: 400px;
    padding: var(--space-4);
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    resize: vertical;
}

.json-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.json-actions {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.json-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
}

.json-status.valid {
    background-color: var(--accent-light);
    color: var(--accent);
}

.json-status.invalid {
    background-color: var(--error-light);
    color: var(--error);
}

/* ----------------------------------------
   Text Tool
   ---------------------------------------- */
.text-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.text-stat-item {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    text-align: center;
}

.text-stat-value {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.text-stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ----------------------------------------
   Diff Tool
   ---------------------------------------- */
.diff-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.diff-header {
    display: flex;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.diff-header-col {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.diff-header-col:first-child {
    border-right: 1px solid var(--border);
}

.diff-content {
    display: flex;
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--text-sm);
    line-height: 1.6;
}

.diff-col {
    flex: 1;
    padding: var(--space-4);
    overflow-x: auto;
}

.diff-col:first-child {
    border-right: 1px solid var(--border);
}

.diff-line {
    padding: var(--space-1) 0;
}

.diff-line.added {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.diff-line.removed {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.diff-line.unchanged {
    color: var(--text-secondary);
}

/* ----------------------------------------
   Base64 / URL Tool
   ---------------------------------------- */
.encoder-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.encoder-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}

.encoder-swap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.encoder-swap-btn {
    width: 40px;
    height: 40px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.encoder-swap-btn:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: white;
}

.encoder-swap-btn svg {
    width: 20px;
    height: 20px;
}

/* ----------------------------------------
   Tool Guide / Content Section
   ---------------------------------------- */
.tool-content {
    margin-top: var(--space-10);
    padding-top: var(--space-8);
    border-top: 1px solid var(--border);
}

.tool-content h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.tool-content h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.tool-content p {
    font-size: var(--text-base);
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.tool-content ol,
.tool-content ul {
    list-style-position: inside;
    padding-left: 0;
    margin-left: 0;
    margin-bottom: var(--space-4);
}

.tool-content ol li,
.tool-content ul li {
    font-size: var(--text-base);
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.tool-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--text-sm);
    background-color: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius);
    color: var(--accent);
}

@media (max-width: 768px) {
    .tool-content ol,
    .tool-content ul {
        list-style-position: outside;
        padding-left: 1.4rem;
        margin-left: 0;
    }

    .tool-content ol li,
    .tool-content ul li {
        padding-left: 0.1rem;
    }
}

.tool-faq {
    margin-top: var(--space-6);
}

.faq-item {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-xl);
}

.faq-item summary {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::after {
    content: '+';
    font-size: var(--text-lg);
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    margin-top: var(--space-3);
    margin-bottom: 0;
}

/* ----------------------------------------
   Loading State
   ---------------------------------------- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ----------------------------------------
   Progress Bar
   ---------------------------------------- */
.progress-bar {
    height: 4px;
    background-color: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ----------------------------------------
   Line Numbers for Textarea
   ---------------------------------------- */
.textarea-wrapper {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-primary);
}

.textarea-wrapper.has-header {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: none;
}

.line-numbers {
    width: 45px;
    padding: 12px 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    text-align: right;
    user-select: none;
    overflow: hidden;
    flex-shrink: 0;
}

.line-numbers div {
    padding-right: 10px;
    height: 20.8px;
}

.lined-textarea {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    min-height: 200px;
}

.lined-textarea::placeholder {
    color: var(--text-muted);
}

.lined-textarea:focus {
    outline: none;
}

/* JSON Editor with line numbers */
.json-panel .textarea-wrapper {
    flex: 1;
    min-height: 400px;
}

.json-panel .lined-textarea {
    min-height: 100%;
}
