﻿@charset "UTF-8";

/* ============================================ */
/* استایل‌های مرکز دانلود عمومی */
/* ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 12px;
    overflow-x: hidden;
    max-width: 100%;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    padding: 16px;
}

/* ============================================ */
/* هدر */
/* ============================================ */
.header {
    background: linear-gradient(135deg, #0b4f8a, #1565a9);
    color: white;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-right {
    font-size: 15px;
    opacity: 0.95;
    background: rgba(255,255,255,0.12);
    padding: 6px 20px;
    border-radius: 25px;
    text-align: center;
}

/* ============================================ */
/* هشدار باز شدن پنجره */
/* ============================================ */
.popup-warning {
    background: #fff3cd;
    color: #856404;
    padding: 8px 16px;
    border-radius: 8px;
    border-right: 4px solid #ffc107;
    font-size: 13px;
    margin-bottom: 10px;
    display: none;
}

    .popup-warning.show {
        display: block;
    }

    .popup-warning small {
        display: block;
        font-size: 11px;
        margin-top: 4px;
    }

/* ============================================ */
/* درخت */
/* ============================================ */
.tree-container {
    margin-top: 4px;
    min-height: 200px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 14px;
}

.node-wrapper {
    margin-bottom: 4px;
}

.node-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.2s;
    gap: 8px;
    flex-wrap: wrap;
}

    .node-item:hover {
        background: #f8faff;
        border-color: #c5d5e8;
    }

    .node-item.folder {
        border-right: 3px solid #f59e0b;
        background: #fefcf5;
        cursor: pointer;
    }

        .node-item.folder:hover {
            background: #fdf6e3;
        }

    .node-item.file {
        border-right: 3px solid #0b4f8a;
        background: #f8faff;
    }

        .node-item.file:hover {
            background: #f0f5ff;
        }

    .node-item.expanded {
        background: #f0f7ff;
    }

.node-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 2;
    min-width: 150px;
}

.toggle-icon {
    display: inline-block;
    width: 20px;
    font-size: 12px;
    color: #0b4f8a;
    cursor: pointer;
    text-align: center;
    user-select: none;
    transition: transform 0.2s;
}

    .toggle-icon:hover {
        color: #1565a9;
        font-weight: bold;
    }

.node-item:not(.expanded) .toggle-icon {
    transform: rotate(-90deg);
}

.node-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.node-title {
    font-size: 14px;
    font-weight: 500;
    color: #0b4f8a;
    word-break: break-word;
}

.node-desc {
    font-size: 11px;
    color: #888;
    margin-right: 4px;
}

.node-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex: 0 1 auto;
    min-width: 90px;
}

.node-date {
    font-size: 10px;
    color: #999;
    direction: ltr;
}

.node-size {
    font-size: 10px;
    color: #666;
}

.node-downloads {
    font-size: 10px;
    color: #0b4f8a;
    font-weight: 600;
}

.node-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================ */
/* دکمه‌ها */
/* ============================================ */
.btn-download {
    background: #22c55e;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    transition: all 0.2s;
}

    .btn-download:hover {
        background: #16a34a;
        transform: scale(1.02);
    }

    .btn-download:active {
        transform: scale(0.95);
    }

.btn-share {
    background: #0b4f8a;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    transition: all 0.2s;
}

    .btn-share:hover {
        background: #1565a9;
        transform: scale(1.02);
    }

    .btn-share:active {
        transform: scale(0.95);
    }

/* ============================================ */
/* Empty Folder */
/* ============================================ */
.empty-folder {
    color: #999;
    font-size: 12px;
    padding: 4px 12px;
    border-right: 2px dashed #e0e0e0;
    background: #fafafa;
    border-radius: 4px;
    margin-bottom: 2px;
}

/* ============================================ */
/* خطاها و Empty State */
/* ============================================ */
.error-message {
    background: #fce8e6;
    color: #c62828;
    padding: 10px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-right: 4px solid #c62828;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

    .empty-state .icon {
        font-size: 48px;
        margin-bottom: 12px;
    }

    .empty-state h3 {
        font-size: 18px;
        color: #555;
        margin-bottom: 6px;
    }

    .empty-state p {
        font-size: 14px;
    }

/* ============================================ */
/* Toast برای اشتراک‌گذاری */
/* ============================================ */
.custom-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    z-index: 9999;
    animation: fadeInUp 0.3s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    direction: rtl;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================ */
/* فوتر */
/* ============================================ */
.footer {
    text-align: center;
    padding: 12px 0 4px 0;
    color: #bbb;
    border-top: 1px solid #e9ecef;
    margin-top: 12px;
    font-size: 11px;
}

    .footer a {
        color: #0b4f8a;
        text-decoration: none;
    }

        .footer a:hover {
            text-decoration: underline;
        }

/* ============================================ */
/* Media Queries */
/* ============================================ */

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 10px;
        border-radius: 8px;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
    }

    .header-right {
        font-size: 12px;
        padding: 4px 10px;
    }

    .node-item {
        padding: 6px 10px;
        flex-wrap: wrap;
    }

    .node-details {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        min-width: auto;
    }

    .node-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .btn-download, .btn-share {
        width: 100%;
        text-align: center;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 4px;
    }

    .container {
        padding: 6px;
        border-radius: 6px;
    }

    .header {
        padding: 10px 12px;
    }

    .header-right {
        font-size: 11px;
        padding: 3px 8px;
    }

    .node-title {
        font-size: 12px;
    }

    .node-date, .node-size, .node-downloads {
        font-size: 9px;
    }

    .btn-download, .btn-share {
        font-size: 11px;
        padding: 4px 8px;
    }

    .popup-warning {
        font-size: 12px;
        padding: 6px 12px;
    }
}
