/*
Theme Name: Image Uploader Pro
Theme URI: https://tejaratgardan.ir/
Author: تجارت گردان
Author URI: https://tejaratgardan.ir/
Description: قالب آپلود و اشتراک‌گذاری تصاویر با امکان دریافت لینک مستقیم
Version: 1.0
License: GNU General Public License v2 or later
License URI: https://tejaratgardan.ir/
Text Domain: image-uploader
*/

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

html, body {
    width: 100%;
    height: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    direction: rtl;
    padding: 10px;
    font-size: 16px;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: block;
}

@media (min-width: 1025px) {
    .container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        padding: 30px;
        max-width: 1200px;
    }
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    width: 100%;
}

@media (min-width: 1025px) {
    .header {
        grid-column: 1 / -1;
        margin-bottom: 30px;
        padding-bottom: 20px;
    }
}

.header h1 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 5px;
}

@media (min-width: 768px) {
    .header h1 {
        font-size: 2em;
    }
}

.header p {
    color: #666;
    font-size: 0.9em;
}

@media (min-width: 768px) {
    .header p {
        font-size: 0.95em;
    }
}

.header button {
    background: #ff4444;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 0.8em;
    transition: background 0.3s;
}

@media (min-width: 768px) {
    .header button {
        padding: 8px 20px;
        font-size: 0.9em;
    }
}

.header button:hover {
    background: #ff2222;
}

.error-message {
    display: none;
    background: #fee;
    color: #c00;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    border-right: 4px solid #c00;
    font-size: 0.9em;
}

.breadcrumb-box {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 12px;
    max-height: 100px;
    overflow-y: auto;
}

.breadcrumb-box::-webkit-scrollbar {
    width: 4px;
}

.breadcrumb-box::-webkit-scrollbar-thumb {
    background: #0066cc;
    border-radius: 10px;
}

.breadcrumb-label {
    color: #666;
    font-size: 0.85em;
    margin-bottom: 4px;
    display: block;
}

.breadcrumb-box span {
    display: block;
    color: #0066cc;
    font-weight: bold;
    font-size: 0.9em;
    word-break: break-word;
}

.folder-section {
    margin-bottom: 15px;
    width: 100%;
}

.folder-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-direction: column;
}

@media (min-width: 768px) {
    .folder-header {
        flex-direction: row;
    }
}

.folder-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
}

.create-folder-btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
}

.create-folder-btn:hover {
    background: #0052a3;
}

.folders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.folder-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.folder-item:hover {
    background: #f0f0f0;
    border-color: #0066cc;
}

.folder-icon {
    font-size: 1.5em;
    padding: 8px 0;
}

.folder-name {
    font-size: 0.75em;
    color: #333;
    word-break: break-word;
    max-height: 40px;
    overflow: hidden;
}

.folder-item .delete-btn {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    padding: 0;
    cursor: pointer;
    font-size: 0.7em;
    display: none;
}

.folder-item:hover .delete-btn {
    display: block;
}

.upload-section {
    width: 100%;
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 25px 12px;
    text-align: center;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .upload-area {
        padding: 40px 20px;
        margin-bottom: 20px;
    }
}

.upload-area:hover {
    background: #f0f0f0;
    border-color: #999;
}

.upload-area.dragover {
    background: #e8f0ff;
    border-color: #0066cc;
}

.upload-icon {
    font-size: 2em;
    color: #666;
    margin-bottom: 8px;
}

@media (min-width: 768px) {
    .upload-icon {
        font-size: 3em;
        margin-bottom: 15px;
    }
}

.upload-area h3 {
    color: #333;
    margin-bottom: 5px;
    font-size: 1em;
}

@media (min-width: 768px) {
    .upload-area h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
}

.upload-area p {
    color: #666;
    font-size: 0.85em;
}

.file-input {
    display: none;
}

.select-btn {
    background: #0066cc;
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.select-btn:hover {
    background: #0052a3;
}

.progress-container {
    display: none;
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #0066cc;
    width: 0%;
    transition: width 0.3s;
}

.result-container {
    display: none;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
}

@media (min-width: 768px) {
    .result-container {
        padding: 20px;
        margin-top: 20px;
    }
}

.uploaded-image {
    max-width: 100%;
    border-radius: 6px;
    margin-bottom: 12px;
}

.image-info {
    display: flex;
    justify-content: space-around;
    margin: 12px 0;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
    gap: 8px;
}

.info-item {
    text-align: center;
    flex: 1;
}

.info-item .label {
    color: #666;
    font-size: 0.75em;
    margin-bottom: 3px;
}

.info-item .value {
    color: #333;
    font-weight: bold;
    font-size: 0.9em;
}

.link-group {
    margin-bottom: 12px;
}

.link-group label {
    display: block;
    color: #333;
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.85em;
}

.link-input-group {
    display: flex;
    gap: 6px;
    flex-direction: column;
}

@media (min-width: 768px) {
    .link-input-group {
        flex-direction: row;
        gap: 8px;
    }
}

.link-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    direction: ltr;
    text-align: left;
}

.copy-btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    white-space: nowrap;
    transition: background 0.3s;
}

.copy-btn:hover {
    background: #0052a3;
}

.copy-btn.copied {
    background: #4caf50;
}

.upload-another {
    background: #0066cc;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 12px;
    font-size: 0.9em;
    width: 100%;
}

.upload-another:hover {
    background: #0052a3;
}

.storage-stats {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    width: 100%;
}

@media (min-width: 1025px) {
    .storage-stats {
        padding: 15px;
        margin-bottom: 15px;
    }
}

.storage-stats h3 {
    color: #333;
    font-size: 0.95em;
    margin-bottom: 10px;
}

.storage-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 0.85em;
}

@media (min-width: 768px) {
    .storage-info {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

.storage-info-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.storage-info-item .label {
    color: #666;
}

.storage-info-item .value {
    color: #333;
    font-weight: bold;
}

.storage-bar-container {
    background: #f0f0f0;
    border-radius: 3px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

.storage-bar-fill {
    height: 100%;
    background: #4caf50;
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6em;
    font-weight: bold;
}

.storage-bar-fill.warning {
    background: #ff9800;
}

.storage-bar-fill.danger {
    background: #f44336;
}

.storage-percentage {
    text-align: right;
    font-size: 0.75em;
    color: #666;
    margin-top: 2px;
}

.storage-usage-text {
    font-size: 0.8em;
    color: #666;
    margin-top: 8px;
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.files-list-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    width: 100%;
    margin-top: 12px;
}

@media (min-width: 1025px) {
    .files-list-section {
        padding: 15px;
        margin-top: 0;
    }
}

.files-list-section h2 {
    font-size: 1em;
    margin-bottom: 12px;
    color: #333;
}

.files-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.files-list li {
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    border-right: 3px solid #0066cc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.file-name {
    flex: 1;
    word-break: break-all;
    color: #333;
    font-size: 0.85em;
}

.file-name small {
    display: block;
    color: #999;
    font-size: 0.8em;
    margin-top: 2px;
}

.copy-file-btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75em;
    white-space: nowrap;
    transition: background 0.3s;
}

.copy-file-btn:hover {
    background: #0052a3;
}

.copy-file-btn.delete {
    background: #ff4444;
}

.copy-file-btn.delete:hover {
    background: #ff2222;
}

#backBtn {
    background: #ff9800;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

#backBtn:hover {
    background: #f57c00;
}

.footer {
    text-align: center;
    margin-top: 15px;
    color: #999;
    font-size: 0.75em;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
    width: 100%;
}

@media (min-width: 1025px) {
    .footer {
        grid-column: 1 / -1;
        margin-top: 40px;
        font-size: 0.85em;
        padding-top: 20px;
    }
}

/* ============ thumbnail در لیست فایل‌ها ============ */
.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}

.file-row-icon {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    background: #f5f5f5;
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    background: #f0f0f0;
    border-radius: 5px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.file-row-info {
    flex: 1;
    min-width: 0;
}

.file-row-name {
    font-size: 0.85em;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-row-meta {
    font-size: 0.75em;
    color: #999;
    margin-top: 3px;
}

.file-row-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
