/* Text Diff Checker - Professional Styles with Clear Red/Green Labels */
.diff-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.diff-wrapper {
    max-width: 950px;
    margin: 0 auto;
}

.diff-title {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.diff-icon {
    font-size: 2.8rem;
    display: inline-block;
    animation: diffBounce 2s infinite;
}

@keyframes diffBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(-5deg); }
}

.diff-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-family: 'Poppins', sans-serif;
}

.diff-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Tabs */
/* ===== TAB STYLES WITH DESCRIPTIONS ===== */

.diff-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    flex-wrap: wrap;
}

.diff-tab {
    position: relative;
    background: transparent;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    border-radius: 30px;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.diff-tab .diff-tab-badge {
    font-size: 0.55rem;
    font-weight: 400;
    color: var(--text-light);
    opacity: 0.6;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
}

.diff-tab:hover .diff-tab-badge {
    opacity: 1;
    color: var(--primary);
}

.diff-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

.diff-tab.active .diff-tab-badge {
    color: rgba(255,255,255,0.8);
    opacity: 1;
}

.diff-tab:hover:not(.active) {
    background: var(--bg);
    color: var(--primary);
    transform: translateY(-2px);
}

.diff-tab:active {
    transform: scale(0.95);
}

/* Tab Description / Info Box */
.diff-tab-description {
    background: var(--bg);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    min-height: 80px;
}

.diff-tab-info {
    display: none;
    animation: fadeInInfo 0.4s ease;
}

.diff-tab-info.active {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

@keyframes fadeInInfo {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.diff-tab-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.diff-tab-info strong {
    display: block;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.diff-tab-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

.diff-highlight-removed {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}

.diff-highlight-added {
    background: #dcfce7;
    color: #166534;
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}

.dark-mode .diff-highlight-removed {
    background: #7f1d1d;
    color: #fca5a5;
}

.dark-mode .diff-highlight-added {
    background: #14532d;
    color: #86efac;
}

/* Tooltip for tabs (alternative to title attribute) */
.diff-tab[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--text);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 400;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    z-index: 10;
    pointer-events: none;
}

.diff-tab[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--surface);
    z-index: 10;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .diff-tab {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
        flex: 1;
        min-width: 80px;
    }
    
    .diff-tab .diff-tab-badge {
        font-size: 0.5rem;
    }
    
    .diff-tab-description {
        padding: 0.8rem 1rem;
        min-height: 60px;
    }
    
    .diff-tab-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .diff-tab-icon {
        font-size: 1.5rem;
    }
    
    .diff-tab-info p {
        font-size: 0.8rem;
    }
    
    .diff-tab[title]:hover::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .diff-tabs {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .diff-tab {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .diff-tab .diff-tab-badge {
        font-size: 0.5rem;
    }
}

.diff-tab {
    background: transparent;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    border-radius: 30px;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

.diff-tab.active {
    background: var(--primary);
    color: white;
}

.diff-tab:hover:not(.active) {
    background: var(--bg);
    color: var(--primary);
}

/* Input Area */
.diff-input-area {
    margin-bottom: 1.5rem;
}

.diff-input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.diff-input-card {
    background: var(--bg);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid var(--border);
}

.diff-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.diff-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.diff-char-count {
    font-size: 0.75rem;
    color: var(--text-light);
}

.diff-textarea {
    width: 100%;
    min-height: 250px;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'Fira Code', monospace;
    resize: vertical;
    line-height: 1.6;
    transition: border-color 0.2s;
}

.diff-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.diff-input-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.diff-action-small {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.diff-action-small:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.diff-swap-area {
    text-align: center;
    margin: 0.5rem 0;
}

.diff-swap-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.5rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

.diff-swap-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Options */
.diff-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.diff-option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.diff-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.85rem;
}

.diff-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.diff-primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.7rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

.diff-primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99,102,241,0.3);
}

.diff-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Results */
.diff-results {
    margin-top: 1.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.diff-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.diff-result-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.diff-stat {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    background: var(--surface);
}

.diff-stat-added {
    color: #16a34a;
    border: 1px solid #86efac;
}

.diff-stat-removed {
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.diff-stat-changed {
    color: #ca8a04;
    border: 1px solid #fde68a;
}

.diff-stat-similarity {
    color: var(--primary);
    border: 1px solid var(--primary);
}

.diff-result-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diff-nav-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s;
}

.diff-nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.diff-counter {
    font-size: 0.85rem;
    color: var(--text-light);
    min-width: 60px;
    text-align: center;
}

/* Diff Output */
.diff-output {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== CLEAR DIFF STYLES WITH RED/GREEN LABELS ===== */

/* REMOVED - Red with clear label */
.diff-line-removed .diff-line-content {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
    padding-left: 0.4rem;
    position: relative;
}

.diff-line-removed .diff-line-content::before {
    content: "✕ REMOVED ";
    color: #dc2626;
    font-weight: 700;
    font-size: 0.6rem;
    background: #fecaca;
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ADDED - Green with clear label */
.diff-line-added .diff-line-content {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #22c55e;
    padding-left: 0.4rem;
    position: relative;
}

.diff-line-added .diff-line-content::before {
    content: "✓ ADDED ";
    color: #16a34a;
    font-weight: 700;
    font-size: 0.6rem;
    background: #bbf7d0;
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* CHANGED - Yellow with clear label */
.diff-line-changed .diff-line-content {
    background: #fef9c3;
    color: #854d0e;
    border-left: 4px solid #eab308;
    padding-left: 0.4rem;
    position: relative;
}

.diff-line-changed .diff-line-content::before {
    content: "~ CHANGED ";
    color: #ca8a04;
    font-weight: 700;
    font-size: 0.6rem;
    background: #fde68a;
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* UNCHANGED - Default */
.diff-line-unchanged .diff-line-content {
    background: transparent;
    color: var(--text);
}

/* Dark mode for diff */
.dark-mode .diff-line-removed .diff-line-content {
    background: #7f1d1d;
    color: #fca5a5;
    border-left-color: #ef4444;
}

.dark-mode .diff-line-removed .diff-line-content::before {
    background: #991b1b;
    color: #fca5a5;
}

.dark-mode .diff-line-added .diff-line-content {
    background: #14532d;
    color: #86efac;
    border-left-color: #22c55e;
}

.dark-mode .diff-line-added .diff-line-content::before {
    background: #166534;
    color: #86efac;
}

.dark-mode .diff-line-changed .diff-line-content {
    background: #713f12;
    color: #fde047;
    border-left-color: #eab308;
}

.dark-mode .diff-line-changed .diff-line-content::before {
    background: #854d0e;
    color: #fde047;
}

/* Inline diff styles */
.diff-inline-removed {
    background: #fee2e2;
    color: #991b1b;
    text-decoration: line-through;
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    border-left: 3px solid #ef4444;
    display: inline-block;
}

.diff-inline-removed::before {
    content: "−";
    color: #dc2626;
    font-weight: 800;
    margin-right: 0.2rem;
}

.diff-inline-added {
    background: #dcfce7;
    color: #166534;
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    border-left: 3px solid #22c55e;
    display: inline-block;
}

.diff-inline-added::before {
    content: "+";
    color: #16a34a;
    font-weight: 800;
    margin-right: 0.2rem;
}

.dark-mode .diff-inline-removed {
    background: #7f1d1d;
    color: #fca5a5;
    border-left-color: #ef4444;
}

.dark-mode .diff-inline-added {
    background: #14532d;
    color: #86efac;
    border-left-color: #22c55e;
}

/* Side by side row styling */
.diff-sidebyside-row {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 0;
    border-bottom: 1px solid var(--border);
}

.diff-sidebyside-row .diff-line-number {
    min-width: 3.5rem;
    padding: 0.1rem 0.5rem;
    text-align: right;
    color: var(--text-light);
    background: var(--bg);
    user-select: none;
    font-size: 0.75rem;
    border-right: 1px solid var(--border);
}

.diff-sidebyside-row .diff-line-content {
    padding: 0.1rem 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

/* Legend */
.diff-reference {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.diff-reference h3 {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    color: var(--text);
}

.diff-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.diff-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.diff-legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.diff-legend-color.diff-removed {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.diff-legend-color.diff-added {
    background: #dcfce7;
    border-left: 4px solid #22c55e;
}

.diff-legend-color.diff-changed {
    background: #fef9c3;
    border-left: 4px solid #eab308;
}

.diff-legend-color.diff-unchanged {
    background: var(--surface);
}

.diff-legend-label.removed {
    color: #dc2626;
}

.diff-legend-label.added {
    color: #16a34a;
}

.diff-legend-label.changed {
    color: #ca8a04;
}

.dark-mode .diff-legend-color.diff-removed {
    background: #7f1d1d;
    border-left-color: #ef4444;
}

.dark-mode .diff-legend-color.diff-added {
    background: #14532d;
    border-left-color: #22c55e;
}

.dark-mode .diff-legend-color.diff-changed {
    background: #713f12;
    border-left-color: #eab308;
}

.dark-mode .diff-legend-label.removed {
    color: #fca5a5;
}

.dark-mode .diff-legend-label.added {
    color: #86efac;
}

.dark-mode .diff-legend-label.changed {
    color: #fde047;
}

.diff-legend-note {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.diff-legend-note p {
    margin: 0;
}

/* Download Card */
.download-card-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.download-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-radius: 24px;
    padding: 2rem;
    max-width: 500px;
    margin: auto;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.dark-mode .download-card {
    background: linear-gradient(135deg, #1e1e2e, #2d2d44);
}

.download-card-header, .download-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.download-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: white;
}

.download-logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.download-card-body {
    position: relative;
    z-index: 1;
}

.download-calculator-type {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

.download-calculation {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0.3rem 0;
    color: var(--text);
}

.download-result-box {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 16px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
}

.download-result-label {
    color: rgba(255,255,255,0.8);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.download-result-value {
    color: white;
    font-weight: bold;
    word-break: break-word;
}

.download-explanation {
    background: var(--bg);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.65rem;
    margin: 0.6rem 0;
}

.download-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.download-input-item {
    background: var(--bg);
    padding: 0.4rem;
    border-radius: 8px;
    text-align: center;
}

.download-input-label {
    display: block;
    font-size: 0.6rem;
    color: var(--text-light);
}

.download-input-value {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.75rem;
}

.download-brand {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--primary);
}

.download-timestamp {
    font-size: 0.6rem;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .diff-container {
        padding: 0 1rem;
    }
    
    .diff-title {
        font-size: 2rem;
    }
    
    .diff-card {
        padding: 1.2rem;
    }
    
    .diff-input-group {
        grid-template-columns: 1fr;
    }
    
    .diff-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .diff-option-group {
        justify-content: center;
    }
    
    .diff-result-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .diff-result-stats {
        justify-content: center;
    }
    
    .diff-result-actions {
        justify-content: center;
    }
    
    .diff-tab {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }
    
    .diff-legend {
        gap: 0.8rem;
    }
    
    .diff-textarea {
        min-height: 150px;
        font-size: 0.85rem;
    }
    
    .diff-sidebyside-row {
        grid-template-columns: auto 1fr auto 1fr;
        font-size: 0.8rem;
    }
    
    .diff-line-removed .diff-line-content::before,
    .diff-line-added .diff-line-content::before,
    .diff-line-changed .diff-line-content::before {
        font-size: 0.5rem;
        padding: 0.02rem 0.3rem;
    }
}

@media (max-width: 480px) {
    .diff-input-group {
        grid-template-columns: 1fr;
    }
    
    .diff-option-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .diff-checkbox-label {
        font-size: 0.8rem;
    }
    
    .diff-primary-btn,
    .diff-action-btn {
        width: 100%;
        text-align: center;
    }
    
    .diff-sidebyside-row {
        grid-template-columns: 1fr;
        font-size: 0.75rem;
    }
    
    .diff-sidebyside-row .diff-line-number {
        min-width: 2.5rem;
        font-size: 0.6rem;
    }
}