/* mtstyles.css - Styles for LuxMT Translation Interface */

/* ============================================
   TRANSLATION PANELS
   ============================================ */

.translation-panel {
    min-height: 300px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #fff;
    position: relative;
    width: 100%; /* Ensure consistent width */
}

.translation-textarea {
    width: 100%;
    height: 100%;
    min-height: 280px;
    border: none;
    resize: none;
    font-size: 16px;
    outline: none;
    overflow-y: scroll !important; /* Force scrollbar to always show */
    overflow-x: hidden;
    line-height: 1.6;
    padding: 8px;
    padding-right: 40px; /* Add space for clear button */
}

/* Source textarea - white background */
#source-text {
    background-color: #ffffff;
}

/* Target textarea - light blue/gray background */
#target-text {
    background-color: #f0f4f8;
    color: #2c3e50;
}

/* Highlighted sentence on hover */
.translation-textarea .sentence-highlight {
    background-color: #fff9c4 !important;
    padding: 2px 0;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.translation-textarea .sentence-highlight:hover {
    background-color: #fff59d !important;
}

/* Synchronized scrolling styles */
.translation-textarea.syncing {
    scroll-behavior: smooth;
}

/* ============================================
   CLEAR BUTTON (Google Translate Style)
   ============================================ */

.clear-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #6c757d;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.clear-button:hover {
    color: #495057;
    background-color: rgba(0, 0, 0, 0.05);
}

.clear-button.show {
    display: flex;
}

/* ============================================
   CHARACTER COUNTER
   ============================================ */

.char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

/* ============================================
   LANGUAGE SELECTOR & SWAP BUTTON
   ============================================ */

.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.swap-button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.swap-button:hover {
    background-color: #f0f0f0;
    border-color: #007bff;
}

/* ============================================
   TRANSLATE BUTTON
   ============================================ */

.translate-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.translate-button:hover {
    background-color: #0056b3;
}

.translate-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.loading-spinner {
    display: none;
    margin-left: 10px;
}

/* ============================================
   STATUS MESSAGES
   ============================================ */

.error-message {
    color: #dc3545;
    margin-top: 10px;
    display: none;
}

.success-message {
    color: #28a745;
    margin-top: 10px;
    display: none;
}

/* ============================================
   ACTION BUTTONS (Copy, Download)
   ============================================ */

.action-buttons {
    display: none;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.action-buttons.show {
    display: flex;
}

.action-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
}

.action-btn:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.action-btn i {
    margin-right: 5px;
}

/* ============================================
   FILE UPLOAD
   ============================================ */

.file-upload-container {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.file-upload-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-upload-btn:hover {
    background: #0056b3;
}

.file-info {
    font-size: 12px;
    color: #666;
    font-style: italic;
    word-break: break-all;
}

/* ============================================
   DETECTED LANGUAGE BADGE
   ============================================ */

.detected-lang-badge {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
    white-space: nowrap;
}

/* ============================================
   SCROLL SYNC INDICATOR
   ============================================ */

.scroll-sync-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    display: none;
    z-index: 10;
    pointer-events: none;
}

.scroll-sync-badge.active {
    display: block;
    animation: fadeInOut 1s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* ============================================
   LAYOUT - EQUAL WIDTH COLUMNS & MAX-WIDTH
   ============================================ */

/* Container max-width similar to Google Translate */
.container-fluid > .row > .col-12 {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%; /* Ensure full width on mobile */
}

/* Ensure both columns have equal width */
.row.g-3 > .col-md-6 {
    flex: 0 0 calc(50% - 20px); /* Account for gap */
}

@media (min-width: 768px) {
    .row.g-3 > .col-md-6:first-child {
        padding-right: 10px;
    }
    
    .row.g-3 > .col-md-6:last-child {
        padding-left: 10px;
    }
}

/* Mobile: ensure columns stack and take full width */
@media (max-width: 767px) {
    .row.g-3 > .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* ============================================
   RESPONSIVE DESIGN - TABLET
   ============================================ */

@media (max-width: 768px) {
    .file-upload-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .file-upload-btn i {
        font-size: 12px;
    }
    
    .action-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .clear-button {
        width: 24px;
        height: 24px;
        font-size: 20px;
        top: 15px;
        right: 15px;
    }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */

@media (max-width: 576px) {
    .translation-panel {
        min-height: 250px;
    }
    
    .translation-textarea {
        min-height: 230px;
        font-size: 14px;
    }
    
    .file-upload-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .file-upload-btn i {
        font-size: 11px;
    }
    
    .file-upload-btn .btn-text {
        display: none;
    }
    
    .file-upload-btn .btn-text-short {
        display: inline;
    }
    
    .action-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .translate-button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .card {
        padding: 1rem !important;
    }
}

@media (min-width: 577px) {
    .file-upload-btn .btn-text {
        display: inline;
    }
    
    .file-upload-btn .btn-text-short {
        display: none;
    }
}