/**
 * ConvMaster - Diff Checker Styles v1.0
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 700;
    font-size: 1.5rem;
}

.tool-header__icon .icon--diff {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(239, 68, 68, 0.15));
    color: #8b5cf6;
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =====================================================
   FORMAT BADGES
   ===================================================== */
.format-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.format-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-sm);
}

.format-badge--txt {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.format-badge--code {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.format-badge--dev {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* =====================================================
   DIFF CHECKER WIDGET
   ===================================================== */
.diff-checker {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* =====================================================
   OPTIONS BAR
   ===================================================== */
.diff-checker__options {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.diff-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diff-option > label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.diff-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.diff-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

/* Custom Checkbox */
.diff-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.diff-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.diff-checkbox__box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
    background: var(--bg-card);
}

.diff-checkbox__box::after {
    content: '✓';
    font-size: 0.75rem;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.diff-checkbox input:checked + .diff-checkbox__box {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.diff-checkbox input:checked + .diff-checkbox__box::after {
    opacity: 1;
    transform: scale(1);
}

.diff-checkbox__label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* =====================================================
   CONTENT AREA
   ===================================================== */
.diff-checker__content {
    padding: 1.5rem;
}

.diff-checker__workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* =====================================================
   TEXT INPUTS - SIDE BY SIDE
   ===================================================== */
.diff-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: start;
}

.diff-input {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.diff-input__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.diff-input__header > label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.diff-input__actions {
    display: flex;
    gap: 0.5rem;
}

.diff-input__textarea {
    width: 100%;
    padding: 1rem;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 250px;
    transition: border-color 0.2s ease;
    line-height: 1.6;
    tab-size: 2;
}

.diff-input__textarea:focus {
    outline: none;
    border-color: #8b5cf6;
}

.diff-input__textarea::placeholder {
    color: var(--text-muted);
}

.diff-input__info {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Swap Button */
.diff-swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-top: 2.5rem;
    padding: 0;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.diff-swap-btn:hover {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
    transform: rotate(180deg);
}

/* File Input Button */
.btn--file {
    cursor: pointer;
}

.btn--file input[hidden] {
    display: none;
}

/* =====================================================
   ACTION BUTTONS
   ===================================================== */
.diff-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* =====================================================
   STATISTICS
   ===================================================== */
.diff-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.diff-stats[hidden] {
    display: none !important;
}

.diff-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.diff-stat__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.diff-stat--added .diff-stat__icon {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.diff-stat--removed .diff-stat__icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.diff-stat--modified .diff-stat__icon {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.diff-stat--unchanged .diff-stat__icon {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.diff-stat__value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.diff-stat__label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* =====================================================
   MESSAGE AREA
   ===================================================== */
.diff-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-md);
}

.diff-message[hidden] {
    display: none !important;
}

.diff-message--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.diff-message--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.diff-message--info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.diff-message__icon {
    font-size: 1.25rem;
}

.diff-message__text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* =====================================================
   RESULT SECTION
   ===================================================== */
.diff-result {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.diff-result[hidden] {
    display: none !important;
}

.diff-result__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.diff-result__header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.diff-result__icon {
    font-size: 1.1rem;
}

.diff-result__actions {
    display: flex;
    gap: 0.5rem;
}

/* =====================================================
   SPLIT VIEW
   ===================================================== */
.diff-view--split {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.diff-view--split[hidden] {
    display: none !important;
}

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

.diff-panel--original {
    border-right: 1px solid var(--border-color);
}

.diff-panel__header {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.diff-panel__content {
    flex: 1;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    background: var(--bg-card);
}

/* =====================================================
   UNIFIED VIEW
   ===================================================== */
.diff-view--unified {
    background: var(--bg-card);
}

.diff-view--unified[hidden] {
    display: none !important;
}

.diff-unified__content {
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
}

/* =====================================================
   DIFF LINE STYLES
   ===================================================== */
.diff-line {
    display: flex;
    min-height: 1.6em;
    white-space: pre;
}

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

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

.diff-line--modified {
    background: rgba(245, 158, 11, 0.1);
}

.diff-line--unchanged {
    background: transparent;
}

.diff-line--empty {
    background: var(--bg-tertiary);
}

.diff-line--context-collapsed {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-style: italic;
    justify-content: center;
    padding: 0.25rem;
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
}

.diff-line__number {
    flex-shrink: 0;
    width: 50px;
    padding: 0 0.5rem;
    text-align: right;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    user-select: none;
}

.diff-line__number--hidden {
    visibility: hidden;
}

.diff-line__prefix {
    flex-shrink: 0;
    width: 20px;
    padding: 0 0.25rem;
    text-align: center;
    font-weight: 700;
    user-select: none;
}

.diff-line--added .diff-line__prefix {
    color: #22c55e;
}

.diff-line--removed .diff-line__prefix {
    color: #ef4444;
}

.diff-line--modified .diff-line__prefix {
    color: #f59e0b;
}

.diff-line__content {
    flex: 1;
    padding: 0 0.5rem;
    overflow-x: auto;
}

/* Inline highlights for word-level diff */
.diff-highlight--added {
    background: rgba(34, 197, 94, 0.3);
    border-radius: 2px;
}

.diff-highlight--removed {
    background: rgba(239, 68, 68, 0.3);
    border-radius: 2px;
}

/* Line numbers hidden state */
.diff-panel__content.no-line-numbers .diff-line__number,
.diff-unified__content.no-line-numbers .diff-line__number {
    display: none;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn--primary {
    background: #8b5cf6;
    color: white;
}

.btn--primary:hover {
    background: #7c3aed;
    transform: translateY(-1px);
}

.btn--secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn--secondary:hover {
    background: var(--bg-secondary);
    border-color: #8b5cf6;
}

.btn--small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn--large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn--success {
    background: #22c55e !important;
    border-color: #22c55e !important;
    color: white !important;
}

.btn svg {
    flex-shrink: 0;
}

.btn[hidden] {
    display: none !important;
}

/* =====================================================
   PRIVACY NOTICE
   ===================================================== */
.diff-privacy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-top: 1px solid var(--border-color);
}

.diff-privacy span {
    font-size: 1rem;
}

.diff-privacy p {
    font-size: 0.85rem;
    color: #8b5cf6;
    margin: 0;
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.tool-section p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.feature-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.step-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #8b5cf6;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Use Cases Grid */
.usecases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.usecase-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.usecase-card code {
    padding: 0.25rem 0.5rem;
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    border-radius: var(--radius-sm);
}

.usecase-card span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

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

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-muted);
}

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

.faq-item p {
    padding: 0 1.5rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =====================================================
   HIDDEN ELEMENTS
   ===================================================== */
[hidden] {
    display: none !important;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .diff-inputs {
        grid-template-columns: 1fr;
    }
    
    .diff-swap-btn {
        margin: 0 auto;
        transform: rotate(90deg);
    }
    
    .diff-swap-btn:hover {
        transform: rotate(270deg);
    }
    
    .diff-view--split {
        grid-template-columns: 1fr;
    }
    
    .diff-panel--original {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 640px) {
    .tool-page {
        padding: 1rem;
    }
    
    .tool-header {
        flex-direction: column;
        text-align: center;
    }
    
    .diff-checker__options {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .diff-option {
        flex-wrap: wrap;
    }
    
    .diff-checker__content {
        padding: 1rem;
    }
    
    .diff-input__header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .diff-input__actions {
        width: 100%;
    }
    
    .diff-input__actions .btn {
        flex: 1;
    }
    
    .diff-result__header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .diff-result__actions {
        width: 100%;
    }
    
    .diff-result__actions .btn {
        flex: 1;
    }
    
    .diff-stats {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .diff-stat {
        justify-content: center;
    }
    
    .btn--large {
        width: 100%;
    }
    
    .format-badges {
        justify-content: center;
    }
    
    .diff-line__number {
        width: 35px;
        font-size: 0.7rem;
    }
}

/* =====================================================
   LIGHT THEME ADJUSTMENTS
   ===================================================== */
[data-theme="light"] .diff-input__textarea {
    background: var(--bg-primary);
}

[data-theme="light"] .diff-select {
    background: white;
}

[data-theme="light"] .diff-checkbox__box {
    background: white;
}

[data-theme="light"] .diff-stat {
    background: white;
}

[data-theme="light"] .diff-panel__content {
    background: white;
}

[data-theme="light"] .diff-unified__content {
    background: white;
}

[data-theme="light"] .diff-line__number {
    background: #f8fafc;
}

[data-theme="light"] .diff-line--empty {
    background: #f1f5f9;
}

[data-theme="light"] .diff-line--context-collapsed {
    background: #f1f5f9;
}
