* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    direction: rtl;
}

/* نوار بالا */
.top-bar {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid #e74c3c;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: bold;
}

.logo-img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid #e74c3c;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: #ddd;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.nav-links a:hover {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: #fff;
    transform: translateY(-2px);
}

/* کانتینر اصلی */
.converter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.header-section {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.features-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.feature {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    transition: all 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.feature i {
    color: #e74c3c;
    font-size: 1.2rem;
}

/* بخش آپلود */
.upload-section {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
}

.upload-area {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 3px dashed rgba(231, 76, 60, 0.5);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area.drag-over {
    background: rgba(231, 76, 60, 0.1);
    border-color: #e74c3c;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: #e74c3c;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.upload-area p {
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.upload-info {
    font-size: 0.9rem;
    opacity: 0.6;
}

.upload-btn {
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 2rem;
}

.upload-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.upload-tips {
    flex: 0 0 300px;
    background: rgba(52, 152, 219, 0.1);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.upload-tips h4 {
    color: #3498db;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-tips ul {
    list-style: none;
    padding-right: 1.5rem;
}

.upload-tips li {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.upload-tips li:before {
    content: '✓';
    position: absolute;
    right: -1.5rem;
    color: #2ecc71;
    font-weight: bold;
}

/* بخش پیش‌نمایش */
.preview-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(231, 76, 60, 0.3);
}

.section-header h3 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f39c12;
}

.image-count {
    background: rgba(231, 76, 60, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

/* لیست عکس‌ها */
.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
}

.image-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.image-item:hover {
    transform: translateY(-5px);
    border-color: #e74c3c;
}

.image-item.selected {
    border-color: #2ecc71;
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.image-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
}

.image-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.image-size {
    font-size: 0.8rem;
    opacity: 0.7;
}

.image-actions {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
}

.image-action-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.image-action-btn:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

.image-order {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

/* تنظیمات PDF */
.pdf-settings {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.pdf-settings h4 {
    color: #3498db;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: #f39c12;
}

.setting-select, .setting-input {
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: rgb(248, 0, 0);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.setting-select:focus, .setting-input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.advanced-settings {
    margin-top: 2rem;
}

.advanced-toggle {
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid #3498db;
    color: #3498db;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    width: 100%;
    transition: all 0.3s;
}

.advanced-toggle:hover {
    background: rgba(52, 152, 219, 0.3);
}

.advanced-content {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.advanced-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.advanced-item label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.advanced-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.watermark-settings {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-top: 1rem;
}

.watermark-input {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.watermark-input input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.watermark-input input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.watermark-input select {
    padding: 10px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    min-width: 150px;
}

/* دکمه‌های اقدام */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.action-btn {
    padding: 12px 30px;
    border-radius: 25px;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    min-width: 180px;
    justify-content: center;
}

.clear-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

.arrange-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.convert-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* بخش نتیجه */
.result-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 3rem;
    border: 1px solid rgba(46, 204, 113, 0.5);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.success-icon {
    font-size: 4rem;
    color: #2ecc71;
    margin-bottom: 1rem;
}

.result-header h3 {
    font-size: 2rem;
    color: #2ecc71;
}

.result-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.result-item i {
    font-size: 2rem;
    color: #3498db;
}

.result-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.result-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: #f39c12;
}

.result-preview {
    margin-bottom: 2rem;
}

.pdf-preview {
    width: 100%;
    height: 500px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.result-btn {
    padding: 12px 30px;
    border-radius: 25px;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    min-width: 180px;
    justify-content: center;
}

.download-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.share-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
}

.new-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.result-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* راهنمای استفاده */
.guide-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 3rem;
    border: 1px solid rgba(155, 89, 182, 0.5);
}

.guide-section h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #9b59b6;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.guide-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.step {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    position: relative;
    transition: all 0.3s;
}

.step:hover {
    transform: translateY(-10px);
    background: rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.5);
}

.step-number {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.step-icon {
    font-size: 3rem;
    color: #9b59b6;
    margin-bottom: 1rem;
}

.step h4 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #fff;
}

.step p {
    opacity: 0.8;
    line-height: 1.6;
}

/* آمار */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
    color: #f39c12;
    margin-bottom: 1rem;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1002;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 2rem;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    border: 2px solid #e74c3c;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.arrange-list {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.arrange-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: move;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.arrange-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #e74c3c;
}

.arrange-item.dragging {
    opacity: 0.5;
    background: rgba(231, 76, 60, 0.2);
}

.arrange-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.arrange-info {
    flex: 1;
}

.arrange-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.arrange-size {
    font-size: 0.8rem;
    opacity: 0.7;
}

.arrange-order {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.2rem;
    min-width: 30px;
    text-align: center;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-btn {
    padding: 10px 30px;
    border-radius: 25px;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.save-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.modal-btn:hover {
    transform: translateY(-2px);
}

/* Modal بارگذاری */
.loading-modal {
    text-align: center;
    max-width: 400px;
}

.loader {
    padding: 2rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid #e74c3c;
    border-radius: 50%;
    margin: 0 auto 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    height: 20px;
    border-radius: 10px;
    margin: 1rem 0;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #f39c12);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.loading-details {
    margin-top: 1rem;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* اسکرول‌بار زیبا */
.image-list::-webkit-scrollbar,
.arrange-list::-webkit-scrollbar {
    width: 8px;
}

.image-list::-webkit-scrollbar-track,
.arrange-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.image-list::-webkit-scrollbar-thumb,
.arrange-list::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    border-radius: 4px;
}

.image-list::-webkit-scrollbar-thumb:hover,
.arrange-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #f39c12, #e74c3c);
}

/* ریسپانسیو */
@media (max-width: 1024px) {
    .upload-section {
        flex-direction: column;
    }
    
    .upload-tips {
        flex: none;
        width: 100%;
    }
    
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .converter-container {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .features-bar {
        gap: 1rem;
    }
    
    .feature {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .action-buttons,
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn,
    .result-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .guide-steps {
        grid-template-columns: 1fr;
    }
    
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-btn {
        width: 100%;
    }
    
    .image-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
    
    .result-info {
        grid-template-columns: 1fr;
    }
    
    .pdf-preview {
        height: 300px;
    }
    
    .watermark-input {
        flex-direction: column;
        align-items: stretch;
    }
    
    .watermark-input input[type="text"] {
        min-width: auto;
    }
}