/* Tool Box Section Styles */
.tool-box-section {
    position: relative;
    z-index: 10;
    width: 100%;
    margin: 0 auto;
}

/* Main Container with Sidebar */
.tool-container-main {
    display: flex;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #eaecf0;
}

/* Sidebar Styling */
.tool-sidebar {
    width: 74px;
    background: #fdfdfd;
    border-right: 1px solid #eaecf0;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}

.tool-sidebar:hover {
    width: 260px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
}

.tool-sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 260px;
    /* Keep items fixed width to prevent wrapping during transition */
}

.tool-sidebar-menu-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    color: #475467;
    white-space: nowrap;
}

.tool-sidebar-menu-item i {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
    color: #667085;
    flex-shrink: 0;
}

.tool-sidebar-menu-item span {
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.tool-sidebar:hover .tool-sidebar-menu-item span {
    opacity: 1;
    pointer-events: auto;
}

.tool-sidebar-menu-item:hover {
    background: #f1f4f9;
    color: #101828;
}

.tool-sidebar-menu-item.active {
    background: #f4f5f7;
    border-left-color: var(--color-primary, #805AF5);
    color: #101828;
}

.tool-sidebar-menu-item.active i {
    color: var(--color-primary, #805AF5);
}

.tool-sidebar-menu-item.active.humanizer {
    border-left-color: var(--color-primary, #805AF5);
}

.tool-sidebar-menu-item.active.humanizer i {
    color: var(--color-primary, #805AF5);
}

/* Tool Wrapper Adjustment */
.tool-wrapper {
    flex: 1;
    display: flex;
    gap: 0;
    align-items: stretch;
    transition: all 0.3s ease;
}

/* Input Column (Inside Tablet-like wrap) */
.tool-input-column {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    border-right: 1px solid #eaecf0;
}

.tool-textarea-container {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

.tool-textarea {
    width: 100%;
    min-height: 250px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 15px;
    resize: none;
    outline: none;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    font-family: inherit;
    background: transparent;
    transition: border-color 0.3s ease;
}

.tool-textarea:focus {
    /* min-height: 350px; Removed to prevent jump */
    border-color: rgba(128, 90, 245, 0.1);
}

.tool-textarea::placeholder {
    color: #aaa;
    font-size: 13px;
}

/* Text Area Actions (Paste / Clear) */
.textarea-actions {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.action-btn-mini {
    background: #f5f5f7;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn-mini:hover {
    background: #eef2ff;
    color: var(--color-primary, #805AF5);
    border-color: var(--color-primary, #805AF5);
}

/* Controls (Buttons Below Textarea) */
.tool-controls {
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.tool-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    background: #ffffff;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    white-space: nowrap;
}

.tool-action-btn i {
    font-size: 18px;
    color: #888;
    transition: all 0.3s ease;
}

.tool-action-btn:hover,
.tool-action-btn.active {
    border-color: var(--color-primary, #805AF5);
    background: var(--color-primary, #805AF5);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(128, 90, 245, 0.2);
}

.tool-action-btn:hover i,
.tool-action-btn.active i {
    color: #ffffff;
}

/* Result Column */
.tool-result-column {
    width: 380px;
    flex: 0 0 380px;
    height: auto;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 24px;
}

/* Base Result Card Adjustment */
.tool-result-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    animation: fadeIn 0.4s ease-out forwards;
    display: none;
    overflow: hidden;
    max-height: 85vh;
    color: #333;
    display: flex;
    flex-direction: column;
}

#result-content-area {
    overflow-y: auto;
    max-height: calc(85vh - 120px);
    padding-right: 10px;
}

#result-content-area::-webkit-scrollbar {
    width: 6px;
}

#result-content-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#result-content-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#result-content-area::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Custom Light Layout for Plagiarism */
.plag-result-header {
    padding: 0 0 20px 0;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

.plag-result-header h5 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.plag-percent-large {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 10px 0;
}

.plag-subtitle {
    display: block;
    color: #666;
    font-size: 0.95rem;
}

.plag-details-title {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    display: block;
    text-align: left;
    margin-bottom: 10px;
}

.plag-details-list {
    padding: 0;
    overflow-y: auto;
    max-height: 400px;
    text-align: left;
    scrollbar-width: thin;
}

.query-item {
    background: #f9f9f9;
    border-left: 4px solid #ddd;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
}

.query-item.is-plagiarized {
    border-left-color: #ef4444;
    background: #fff5f5;
}

.query-item.is-unique {
    border-left-color: var(--color-primary, #805AF5);
    background: #f0fdf4;
}

.query-text {
    font-style: italic;
    color: #555;
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.match-status {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.match-status.red {
    color: #dc2626;
}

.match-status.green {
    color: var(--color-primary, #805AF5);
}

.source-link {
    display: block;
    color: #4f46e5;
    font-size: 0.85rem;
    text-decoration: none;
    margin-bottom: 4px;
    transition: color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-link:hover {
    color: #4338ca;
    text-decoration: underline;
}

/* AI Detector Result Styles */
.ai-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 10px;
    color: #fff;
}

.ai-badge.high {
    background: var(--color-primary, #805AF5);
}

.ai-badge.medium {
    background: #f59e0b;
}

.ai-badge.low {
    background: #ef4444;
}

.ai-score-large {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
}

.ai-score-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 15px;
}

.probability-breakdown {
    background: #f9fafb;
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
}

.breakdown-title {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.progress-multi {
    height: 10px;
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    background: #e5e7eb;
    margin-bottom: 10px;
}

.progress-bar-ai {
    background: #ef4444;
}

.progress-bar-mixed {
    background: #f59e0b;
}

.progress-bar-human {
    background: var(--color-primary, #805AF5);
}

.breakdown-dots {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 12px;
    font-weight: 600;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.ai-sentences-list {
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.ai-sentence-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-left: 4px solid #ef4444;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.sentence-text {
    flex: 1;
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.sentence-pct {
    background: #ef4444;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* Humanizer Result Styles */
.humanized-text-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    font-size: 16px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
    margin: 15px 0;
    color: #374151;
}

.humanized-highlight {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

.btn-purple {
    background: #8b5cf6;
    color: #fff !important;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-purple:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.2);
}

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

.pdf-btn {
    background: #fff5f5;
    color: #ef4444 !important;
    border: 1px solid #fee2e2;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pdf-btn:hover {
    background: #fee2e2;
}

/* Loader Styles */
.tool-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 30px;
    height: 100%;
    min-height: 300px;
    animation: fadeIn 0.3s ease-out;
    box-shadow: none;
}

.custom-tool-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(128, 90, 245, 0.1);
    border-left-color: var(--color-primary, #805AF5);
    border-radius: 50%;
    animation: custom_spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: #666;
    text-align: center;
}

@keyframes custom_spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .tool-wrapper {
        flex-direction: column;
    }

    .tool-input-column,
    .tool-result-column {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
    }

    .tool-result-column {
        margin-top: 20px;
    }
}