/* ============================================
 *    Apache Autoindex - Modern Clean Theme
 *       ============================================ */

:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e6e9ef;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --folder-color: #f39c12;
    --file-color: #95a5a6;
    --row-hover: #f0f7ff;
    --header-bg: #fafbfc;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --radius: 10px;
}

* {
*     box-sizing: border-box;
*     }
*
*     body {
*         font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
*                          "Helvetica Neue", Arial, "Vazirmatn", sans-serif;
*                              background: var(--bg-color);
*                                  background-image:
*                                          radial-gradient(circle at 10% 10%, #e8f0fe 0%, transparent 40%),
*                                                  radial-gradient(circle at 90% 90%, #fde8e8 0%, transparent 40%);
*                                                      background-attachment: fixed;
*                                                          color: var(--text-color);
*                                                              margin: 0;
*                                                                  padding: 40px 20px;
*                                                                      min-height: 100vh;
*                                                                          line-height: 1.6;
*                                                                          }
*
*/* کانتینر اصلی */
h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    margin: 0 0 25px 0;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    word-break: break-word;
}

h1 a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

h1 a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* جدول اصلی */
table {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* سربرگ جدول */
th {
    background: var(--header-bg);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

th a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

th a:hover {
    color: var(--accent-color);
}

/* ردیف‌ها */
td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: background-color 0.15s ease;
}

tr:hover td {
    background: var(--row-hover);
}

/* لینک‌ها */
td a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

td a:hover {
    color: var(--accent-color);
}

/* آیکون پوشه و فایل با شبه‌عنصر */
td a[href$="/"]::before {
    content: "📁";
    font-size: 18px;
    filter: hue-rotate(0deg);
}

td a:not([href$="/"])::before {
    content: "📄";
    font-size: 18px;
    opacity: 0.7;
}

/* ستون آیکون پیش‌فرض آپاچی (اختیاری، مخفی کردن) */
td:first-child:not(:last-child) {
    width: 40px;
    padding-right: 0;
}

/* ستون سایز و تاریخ */
td:last-child,
td:nth-last-child(2) {
    color: var(--text-muted);
    font-size: 13px;
    font-family: "SF Mono", Consolas, Monaco, monospace;
    white-space: nowrap;
    text-align: right;
}

/* رنگ متفاوت برای پوشه‌ها */
tr td a[href$="/"] {
    color: var(--folder-color);
    font-weight: 600;
}

tr td a[href$="/"]:hover {
    color: #e67e22;
}

/* والد (Parent Directory) */
td a[href="../"],
td a[href="/"] {
    color: var(--accent-color);
    font-weight: 600;
}

/* ریسپانسیو */
@media (max-width: 700px) {
    body {
        padding: 15px 10px;
    }

    h1 {
        font-size: 17px;
        padding: 15px;
    }

    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }

    td:last-child,
    td:nth-last-child(2) {
        font-size: 11px;
    }

    /* مخفی کردن ستون سایز در موبایل */
    td:nth-last-child(2),
    th:nth-last-child(2) {
        display: none;
    }
}
