/* Reset and base styles */

@import url('font.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'UKIJ Tuz Tom', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #4a5568;
}

.nav {
    display: flex;
    gap: 15px;
}

.nav-link {
    padding: 10px 20px;
    background: #e2e8f0;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Main content */
.main {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Translation area */
.translation-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.label-with-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-section label,
.output-section label {
    font-weight: 500;
    color: #4a5568;
    font-size: 1rem;
}

.char-count {
    font-size: 0.85rem;
    color: #718096;
    font-weight: 400;
    padding: 4px 8px;
    background: #e2e8f0;
    border-radius: 4px;
}

/* Translate section */
.translate-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

textarea {
    height: 400px;
    min-height: 400px;
    max-height: 400px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    resize: none;
    background: white;
    color: #2d3748;
    line-height: 1.6;
    overflow-y: auto;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea::placeholder {
    color: #a0aec0;
}

#output-text {
    background: #f7fafc;
    color: #2d3748;
}

.translate-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.translate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

#status-text {
    font-weight: 500;
    color: #4a5568;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    animation: progress 1.5s ease-in-out infinite;
}

@keyframes progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}



.settings-container h2 {
    color: #4a5568;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.5rem;
}

.settings-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.settings-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.prompt-group {
    margin-bottom: 20px;
}

.prompt-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.prompt-group textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    background: white;
    color: #4a5568;
    resize: vertical;
}

.prompt-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.prompt-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

.reset-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(246, 173, 85, 0.4);
}

.reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(246, 173, 85, 0.6);
}

/* Dictionary management styles - shared */
.dictionary-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dictionary-controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.dictionary-controls h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.add-term {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-term input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: #4a5568;
}

.add-term input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.dictionary-list {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    max-height: 400px;
    overflow-y: auto;
}

.dictionary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.dictionary-item:last-child {
    border-bottom: none;
}

.dictionary-item:hover {
    background: #f7fafc;
}

.term-pair {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.term-original {
    font-weight: 500;
    color: #2d3748;
}

.term-translation {
    color: #4a5568;
    font-size: 0.9rem;
}

.delete-term {
    padding: 6px 12px;
    background: #fed7d7;
    color: #822727;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}


.dictionary-container h2 {
    color: #4a5568;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.5rem;
}

.dictionary-stats {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    text-align: center;
    min-width: 120px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: #667eea;
}

.stat-label {
    color: #4a5568;
    font-size: 0.9rem;
    margin-top: 5px;
}

.search-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.search-section h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.search-controls {
    display: flex;
    gap: 10px;
}

.search-controls input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: #4a5568;
}

.search-controls input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.clear-btn {
    padding: 10px 20px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.dictionary-list-container {
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

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

.edit-term {
    padding: 4px 8px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-term:hover {
    background: #cbd5e0;
}

.dictionary-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.export-btn,
.import-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

.export-btn:hover,
.import-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.6);
}

.danger-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
}

.danger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.6);
}

.api-key-group,
.model-group {
    margin-bottom: 20px;
}

.api-key-group label,
.model-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.api-key-group input,
.model-group select,
#default-source {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: #4a5568;
}

.api-key-group input:focus,
.model-group select:focus,
#default-source:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.save-btn,
.cancel-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.6);
}

.cancel-btn {
    background: #e2e8f0;
    color: #4a5568;
}

.cancel-btn:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.status-message {
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-weight: 500;
    text-align: center;
}

.status-message.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.status-message.error {
    background: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .translation-area {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .translate-section {
        margin-bottom: 15px;
    }

    .translate-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    textarea {
        min-height: 250px;
    }

    .settings-actions {
        flex-direction: column;
    }
}

#input-text{
    direction: ltr;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #4a5568;
}

.form-group input {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: #4a5568;
    font-family: 'UKIJ Tuz Tom', Arial, sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    color: #718096;
    font-size: 0.85rem;
}

.auth-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: #764ba2;
}

/* Statistics page styles */
.stats-container {
    max-width: 1400px;
    margin: 0 auto;
}

.stats-container h2 {
    color: #4a5568;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.8rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card h3 {
    color: #4a5568;
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-detail {
    color: #a0aec0;
    font-size: 0.8rem;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-container h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.2rem;
    text-align: center;
}

.chart-container canvas {
    max-height: 300px;
}

.table-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.table-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.2rem;
    text-align: center;
}

.stats-table {
    overflow-x: auto;
}

.stats-table table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stats-table th {
    background: #667eea;
    color: white;
    padding: 12px 15px;
    font-weight: 500;
    text-align: center;
}

.stats-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    background: white;
}

.stats-table tr:hover td {
    background: #f7fafc;
}

.no-data {
    color: #a0aec0;
    font-style: italic;
}

.error-message {
    background: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

/* Responsive design for statistics */
@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-container canvas {
        max-height: 250px;
    }

    .stats-table {
        font-size: 0.9rem;
    }

    .stats-table th,
    .stats-table td {
        padding: 8px 10px;
    }
}