* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
}

/* الشريط العلوي */

header {
    background: white;
    padding: 15px 30px;

    display: flex;
    align-items: center;
    gap: 25px;

    border-bottom: 1px solid #ddd;

    position: sticky;
    top: 0;

    z-index: 100;
}

.logo {
    font-size: 25px;
    font-weight: bold;
}

.search {
    flex: 1;
}

.search input {
    width: 100%;

    padding: 12px 16px;

    border: 1px solid #ccc;
    border-radius: 10px;

    font-size: 16px;
}

nav {
    display: flex;
    gap: 5px;
}

nav button {
    border: none;
    background: transparent;

    padding: 10px 12px;

    cursor: pointer;

    font-size: 15px;

    border-radius: 8px;
}

nav button:hover {
    background: #eeeeee;
}


/* المحتوى */

main {
    padding: 35px;
}

main h1 {
    margin-bottom: 25px;
}


/* بطاقات الملفات */

.products {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(240px, 1fr));

    gap: 25px;
}

.product {
    background: white;

    border-radius: 15px;

    overflow: hidden;

    cursor: pointer;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.08);

    transition: 0.2s;
}

.product:hover {
    transform: translateY(-5px);

    box-shadow:
        0 7px 20px rgba(0, 0, 0, 0.15);
}

.product img {
    width: 100%;

    height: 170px;

    object-fit: cover;
}

.product h2 {
    font-size: 19px;

    margin: 15px;
}

.price,
.free {
    margin: 15px;

    font-size: 18px;

    font-weight: bold;
}

.price {
    color: #1473e6;
}

.free {
    color: #16a05d;
}


/* نافذة تفاصيل المنتج */

.modal {
    display: none;

    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.6);

    align-items: center;

    justify-content: center;

    z-index: 1000;
}

.modal-content {
    background: white;

    width: 90%;

    max-width: 550px;

    padding: 30px;

    border-radius: 15px;

    position: relative;
}

.close {
    position: absolute;

    top: 10px;

    left: 15px;

    border: none;

    background: none;

    font-size: 30px;

    cursor: pointer;
}

.buyButton {
    width: 100%;

    padding: 14px;

    border: none;

    border-radius: 10px;

    background: #1473e6;

    color: white;

    font-size: 17px;

    cursor: pointer;
}

.buyButton:hover {
    background: #095dbd;
}
/* =========================================
   📱 تحسين FileMarket للجوال
   ========================================= */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* الشاشات الصغيرة */
@media (max-width: 768px) {

    body {
        margin: 0;
        padding: 0;
        font-size: 16px;
    }

    .container,
    .content,
    main,
    section {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* الأزرار */
    button,
    input[type="button"],
    input[type="submit"],
    a.button {
        min-height: 46px;
        font-size: 16px;
    }

    /* حقول الإدخال */
    input,
    textarea,
    select {
        width: 100%;
        max-width: 100%;
        min-height: 46px;
        font-size: 16px;
    }

    textarea {
        min-height: 100px;
    }

    /* الصور */
    img {
        max-width: 100%;
        height: auto;
    }

    /* البطاقات */
    .products,
    .product-grid,
    .products-grid,
    .grid {
        grid-template-columns: 1fr !important;
        width: 100%;
    }

    /* منع الجداول من تخريب عرض الهاتف */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    /* العناوين */
    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 22px;
    }

    h3 {
        font-size: 19px;
    }

    /* النوافذ */
    .modal,
    .modal-content {
        width: calc(100% - 24px);
        max-width: 100%;
        margin: 12px auto;
    }

    /* الشات */
    #messages {
        width: 100%;
        max-width: 100%;
    }

    /* الشريط العلوي */
    nav,
    header {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* شاشات الهاتف الصغيرة جدًا */
@media (max-width: 480px) {

    body {
        font-size: 15px;
    }

    h1 {
        font-size: 23px;
    }

    h2 {
        font-size: 20px;
    }

    button {
        width: 100%;
    }

    .container,
    .content,
    main,
    section {
        padding-left: 10px;
        padding-right: 10px;
    }
}
