/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    transition: direction 0.3s ease;
}

/* Arabic Language Support */
body[lang="ar"] {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
}

/* Header Top Controls */
.header-top {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
}

body[lang="ar"] .header-top {
    right: auto;
    left: 20px;
}

.language-toggle {
    display: flex;
    gap: 10px;
}

.language-toggle button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.language-toggle button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.language-toggle button.active {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-color: white;
}

.discord-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #5865F2;
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

.discord-btn:hover {
    background: #4752C4;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(88, 101, 242, 0.4);
}

.footer-discord-link {
    color: #5865F2;
    text-decoration: none;
    font-weight: 600;
    margin-top: 5px;
    display: inline-block;
    transition: color 0.3s ease;
}

.footer-discord-link:hover {
    color: #4752C4;
    text-decoration: underline;
}

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

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.upload-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    padding: 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    background: white;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.tab-btn:disabled {
    color: #adb5bd;
    cursor: not-allowed;
}

.tab-btn i {
    margin-right: 8px;
}

/* RTL Support for Tabs */
body[lang="ar"] .tab-btn i {
    margin-right: 0;
    margin-left: 8px;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 40px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Upload Area */
.upload-area {
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-content {
    transition: opacity 0.3s ease;
}

.upload-icon {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-area p {
    color: #666;
    font-size: 1.1rem;
}

.browse-text {
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.browse-text:hover {
    color: #764ba2;
}

/* Progress Bar */
.upload-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #667eea;
    font-weight: 600;
}

/* Selected Files */
.selected-files {
    margin-top: 30px;
    display: none;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.files-header h4 {
    color: #333;
    font-size: 1.3rem;
}

.file-count {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.file-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.file-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.file-preview {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-info {
    text-align: center;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.9rem;
    word-break: break-word;
}

.file-size {
    color: #666;
    font-size: 0.8rem;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.8;
}

/* RTL Support for Remove Button */
body[lang="ar"] .remove-btn {
    right: auto;
    left: 10px;
}

.remove-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.files-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Confirmation Tab */
.confirm-summary {
    background: #e3f2fd;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.confirm-summary h4 {
    color: #1976d2;
    margin-bottom: 10px;
}

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

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1976d2;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.confirm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.confirm-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
}

.confirm-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.confirm-preview {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.confirm-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.confirm-info {
    flex: 1;
}

.confirm-info h5 {
    color: #333;
    margin-bottom: 5px;
    font-size: 1rem;
    word-break: break-word;
}

.confirm-info p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.file-type {
    color: #667eea;
    font-weight: 600;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Results Tab */
.upload-summary {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #d4edda;
    border-radius: 12px;
    color: #155724;
    font-size: 1.2rem;
    font-weight: 600;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    border-left: 4px solid #28a745;
}

.result-item.error {
    border-left-color: #dc3545;
}

/* RTL Support for Result Items */
body[lang="ar"] .result-item {
    border-left: none;
    border-right: 4px solid #28a745;
}

body[lang="ar"] .result-item.error {
    border-right-color: #dc3545;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.result-preview {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.result-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.error-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8d7da;
    color: #721c24;
    font-size: 2rem;
}

.result-info h5 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1rem;
    word-break: break-word;
}

.result-status {
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-status.error {
    color: #dc3545;
}

.result-status i {
    font-size: 1.1rem;
}

.result-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.result-link {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.copy-btn, .download-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn {
    background: #667eea;
    color: white;
}

.copy-btn:hover {
    background: #764ba2;
}

.download-btn {
    background: #28a745;
    color: white;
}

.download-btn:hover {
    background: #218838;
}

.bulk-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1rem;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #764ba2;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 350px;
    word-wrap: break-word;
}

/* RTL Support for Toast */
body[lang="ar"] .toast {
    right: auto;
    left: 30px;
    transform: translateX(-400px);
}

body[lang="ar"] .toast.show {
    transform: translateX(0);
}

.toast.show {
    transform: translateX(0);
}

.toast i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tab-content {
        padding: 30px 20px;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .files-grid {
        grid-template-columns: 1fr;
    }
    
    .confirm-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .confirm-item {
        flex-direction: column;
        text-align: center;
    }
    
    .files-actions,
    .confirm-actions,
    .bulk-actions {
        flex-direction: column;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .toast {
        right: 15px;
        left: 15px;
        transform: translateY(100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .tab-btn {
        padding: 15px 10px;
        font-size: 1rem;
    }
    
    .tab-btn i {
        display: block;
        margin-bottom: 5px;
        margin-right: 0;
    }
    
    /* RTL Support for Mobile */
    body[lang="ar"] .toast {
        left: 15px;
        right: 15px;
    }
    
    body[lang="ar"] .language-toggle {
        left: 15px;
        right: auto;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 30px 10px;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    .files-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .confirm-preview {
        width: 60px;
        height: 60px;
    }
    
    .tab-navigation {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: 1px solid #dee2e6;
    }
    
    .tab-btn:last-child {
        border-bottom: none;
    }
    
    .tab-btn.active::after {
        height: 100%;
        width: 3px;
        top: 0;
        left: 0;
        right: auto;
        bottom: auto;
    }
}