/* فونت IRANSansWeb */
@font-face {
    font-family: 'IRANSansWeb';
    src: url('fonts/IRANSansWeb.eot');
    src: url('fonts/IRANSansWeb.eot?#iefix') format('embedded-opentype'),
         url('fonts/IRANSansWeb.woff2') format('woff2'),
         url('fonts/IRANSansWeb.woff') format('woff'),
         url('fonts/IRANSansWeb.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansWeb';
    src: url('fonts/IRANSansWeb_Bold.eot');
    src: url('fonts/IRANSansWeb_Bold.eot?#iefix') format('embedded-opentype'),
         url('fonts/IRANSansWeb_Bold.woff2') format('woff2'),
         url('fonts/IRANSansWeb_Bold.woff') format('woff'),
         url('fonts/IRANSansWeb_Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* متغیرها — قالب روشن */
:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface2: #f0f0f2;
    --border: #e0e0e4;
    --text: #1a1a1e;
    --text-muted: #6b6b75;
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --accent-file: #059669;
    --accent-text: #2563eb;
    --error: #dc2626;
    --radius: 14px;
    --font: 'IRANSansWeb', Tahoma, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-width: 520px;
    margin: 0 auto;
}

/* هدر */
.header {
    text-align: center;
    padding: 2.5rem 0 2rem;
}
.header.small {
    padding: 1rem 0 1.5rem;
    text-align: right;
}
.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}
.header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.back {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}
.back:hover {
    color: var(--primary);
}

/* کارت‌های اصلی */
.main {
    flex: 1;
}
.cards {
    display: grid;
    gap: 1.25rem;
    padding: 0 0 2rem;
}
.card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2);
}
.card:active {
    transform: translateY(0);
}
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.card-icon svg {
    width: 26px;
    height: 26px;
}
.card-file .card-icon {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-file);
}
.card-text .card-icon {
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-text);
}
.card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
}
.card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* مشاهده با کد */
.view-code-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
}
.view-code-label {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}
.view-code-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.view-code-form input {
    width: 8rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-align: center;
}
.view-code-form input:focus {
    outline: none;
    border-color: var(--primary);
}
.view-code-form input::placeholder {
    letter-spacing: 0;
    text-transform: none;
}

/* فرم */
.form-page .main {
    padding: 0;
}
.share-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.field span:first-child {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}
.field input[type="text"],
.field input[type="file"],
.field select,
.field textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color 0.2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.field textarea {
    resize: vertical;
    min-height: 120px;
}

/* ناحیه آپلود فایل — ظاهر سفارشی */
.field-file .field span:first-child {
    margin-bottom: 0.25rem;
}
.file-upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.file-upload-zone:hover,
.file-upload-zone:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.06);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.file-upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
}
.file-upload-zone.has-files {
    border-style: solid;
    border-color: var(--accent-file);
    background: rgba(5, 150, 105, 0.06);
}
.file-upload-zone.has-files .file-upload-text {
    color: var(--accent-file);
}
.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}
.file-upload-icon {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}
.file-upload-zone:hover .file-upload-icon,
.file-upload-zone:focus .file-upload-icon {
    color: var(--primary);
}
.file-upload-zone.has-files .file-upload-icon {
    color: var(--accent-file);
}
.file-upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
    transition: color 0.2s;
}
.file-upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.file-names {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    padding: 0.5rem 0;
    line-height: 1.5;
}
.file-names:not(:empty) {
    color: var(--accent-file);
    font-weight: 500;
}
.file-names:not(:empty)::before {
    content: '✓ ';
}

/* دکمه‌ها */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    text-decoration: none;
    margin-top: 1rem;
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
}
.btn-copy {
    background: var(--surface2);
    color: var(--primary);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.btn-copy:hover {
    background: var(--border);
}
.btn-copy.copied {
    background: var(--accent-file);
    color: #ffffff;
    border-color: var(--accent-file);
}

/* نتیجه لینک */
.result-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.result-label {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.link-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.link-row input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
}
.result-hint {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.result-code-hint {
    margin-top: 0.5rem;
}
.result-code-hint strong {
    color: var(--primary);
    font-weight: 600;
}
.error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* صفحه مشاهده متن/فایل */
.view-text-box,
.view-files-box {
    max-width: 100%;
    padding: 1.5rem 0;
}
.view-text {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    margin: 0 0 1rem;
}
.view-files-box h2 {
    font-size: 1.2rem;
    margin: 0 0 1rem;
}
.file-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
.file-list li {
    margin-bottom: 0.5rem;
}
.file-list a {
    color: var(--primary);
    text-decoration: none;
    display: inline-block;
    padding: 0.5rem 0;
}
.file-list a:hover {
    text-decoration: underline;
}

/* آخرین اشتراک‌گذاری‌ها (ریز) */
.recent-shares {
    margin-top: 1.5rem;
    padding: 0.85rem 1rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.recent-shares-title {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.recent-shares-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}
.recent-shares-list li {
    margin: 0;
}
.recent-shares-list a {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
}
.recent-shares-list a:hover {
    text-decoration: underline;
}
.recent-shares-code {
    font-weight: 600;
    letter-spacing: 0.08em;
}
.recent-shares-type {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* فوتر */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.footer-oss {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}
.footer-oss a {
    color: var(--primary);
    text-decoration: none;
}
.footer-oss a:hover {
    text-decoration: underline;
}

/* ریسپانسیو — موبایل: جمع‌وجور برای جلوگیری از اسکرول */
@media (max-width: 480px) {
    .app {
        padding: 0.75rem;
    }
    .header {
        padding: 1rem 0 0.75rem;
    }
    .header h1 {
        font-size: 1.35rem;
    }
    .header p {
        font-size: 0.85rem;
    }
    .cards {
        gap: 0.75rem;
        padding: 0 0 0.75rem;
    }
    .card {
        padding: 0.85rem 1rem;
    }
    .card-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 0.5rem;
    }
    .card-icon svg {
        width: 20px;
        height: 20px;
    }
    .card h2 {
        font-size: 1rem;
        margin: 0 0 0.2rem;
    }
    .card p {
        font-size: 0.8rem;
    }
    .view-code-box {
        padding: 0.85rem 1rem;
        margin-top: 0.5rem;
    }
    .view-code-label {
        margin: 0 0 0.5rem;
        font-size: 0.85rem;
    }
    .view-code-form {
        gap: 0.5rem;
    }
    .view-code-form input {
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
        width: 7rem;
    }
    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }
    .recent-shares {
        margin-top: 1rem;
        padding: 0.65rem 0.85rem;
    }
    .recent-shares-title {
        font-size: 0.7rem;
    }
    .recent-shares-list a {
        font-size: 0.75rem;
    }
    .recent-shares-type {
        font-size: 0.68rem;
    }
    .footer {
        padding: 0.75rem 0;
        font-size: 0.75rem;
    }
}
@media (max-width: 380px) {
    .link-row {
        flex-direction: column;
    }
    .btn-copy {
        width: 100%;
    }
}
@media (min-width: 480px) {
    .cards {
        grid-template-columns: 1fr 1fr;
    }
    .card {
        padding: 2rem 1.5rem;
    }
}
