/* ==============================================
   فایلی ستایلی گشتی - Kurd Shop Pro
   ============================================== */

/* --- گۆڕاوەکان (Variables) --- */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;

    --background-color-light: #f0f2f5;
    --card-bg-light: #ffffff;
    --text-color-light: #212529;
    --text-color-muted-light: #6c757d;
    --border-color-light: #dee2e6;
    
    --background-color-dark: #121212;
    --card-bg-dark: #1e1e1e;
    --text-color-dark: #e4e6eb;
    --text-color-muted-dark: #adb5bd;
    --border-color-dark: #3a3b3c;
    
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.075);
    --border-radius: 12px;
    --font-family-main: 'Noto Sans Arabic', sans-serif;
}

/* --- ستایلی گشتی و بنەڕەتی --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family-main);
    font-size: 16px;
    direction: rtl;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode {
    --app-bg: var(--background-color-light);
    --card-bg: var(--card-bg-light);
    --text-color: var(--text-color-light);
    --text-muted: var(--text-color-muted-light);
    --border-color: var(--border-color-light);
}

body.dark-mode {
    --app-bg: var(--background-color-dark);
    --card-bg: var(--card-bg-dark);
    --text-color: var(--text-color-dark);
    --text-muted: var(--text-color-muted-dark);
    --border-color: var(--border-color-dark);
}

body { background-color: var(--app-bg); color: var(--text-color); }
.container { max-width: 1200px; margin: 0 auto; padding: 15px; }
a { color: var(--primary-color); text-decoration: none; }
img { max-width: 100%; display: block; }

/* --- Header & Navbar --- */
.navbar {
    background-color: var(--card-bg);
    padding: 15px 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky; top: 0; z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}
.navbar .logo a {
    font-size: 1.8rem;
    font-weight: 900;
    font-family: var(--font-family-main);
    color: var(--primary-color);
    letter-spacing: -1px;
}
.nav-menu { list-style: none; display: flex; gap: 25px; margin: 0; padding: 0; }
.nav-menu a {
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
}
.nav-menu a:hover, .nav-menu a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* --- Index Page Card --- */
#products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.product-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.product-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border-color);
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.product-logo-container {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background-color: #e9ecef;
}
.product-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-time-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(2px);
}
.price-overlay-container {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.price-tag {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.price-tag.usd {
    background-color: var(--warning-color);
    color: var(--text-color-light);
}
.price-tag.iqd {
    background-color: var(--success-color);
    color: white;
}
.product-info {
    padding: 16px;
    text-align: right;
    border-top: 1px solid var(--border-color);
    flex-grow: 1;
}
.product-info h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Detail Page --- */
.product-detail-container { background-color: var(--card-bg); border-radius: var(--border-radius); padding: 24px; margin: 20px auto; max-width: 800px; border: 1px solid var(--border-color); }
.product-detail-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 16px; color: var(--text-color); }
.gallery-main-image { width: 100%; border-radius: var(--border-radius); margin-bottom: 16px; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--border-color); }
.gallery-thumbnails { display: flex; overflow-x: auto; gap: 10px; padding: 5px; scrollbar-width: thin; scrollbar-color: var(--primary-color) #e0e0e0; }
.gallery-thumbnails::-webkit-scrollbar { height: 6px; }
.gallery-thumbnails::-webkit-scrollbar-thumb { background-color: var(--primary-color); border-radius: 10px; }
.thumbnail-img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; }
.thumbnail-img.active, .thumbnail-img:hover { border-color: var(--primary-color); }
.info-container h3 { font-size: 1.2rem; font-weight: 600; margin-top: 24px; margin-bottom: 12px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; color: var(--text-color); }
.product-description-full { color: var(--text-muted); line-height: 1.7; word-wrap: break-word; }
.product-description-full img { max-width: 100px; border-radius: 8px; display: block; margin: 10px 0; border: 1px solid var(--border-color); }

.final-info-section {
    background-color: var(--app-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 25px;
    margin-bottom: 15px;
}
.final-info-price {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    font-weight: 700;
    flex-wrap: wrap;
}
.final-info-price .price-usd { font-size: 1.5rem; color: var(--primary-color); }
.final-info-price .price-iqd { font-size: 1.1rem; color: var(--success-color); }
.final-info-time {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

/* --- Buttons --- */
.share-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.share-btn { padding: 12px; border: none; border-radius: 8px; color: white; font-family: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; text-align: center; }
.share-btn.whatsapp { background-color: #25D366; }
.share-btn.telegram { background-color: #0088cc; }
.btn-primary { background-color: var(--primary-color); color: white; border:none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; transition: background-color 0.2s; }
.btn-primary:hover { background-color: #0b5ed7; }
.btn-secondary { background-color: var(--card-bg); color: var(--text-muted); border: 1px solid var(--border-color); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-edit { background-color: var(--warning-color); color: black; }
.btn-delete { background-color: var(--danger-color); color: white; }

/* --- Footer & Theme Switcher --- */
footer { text-align: center; padding: 20px; margin-top: 40px; border-top: 1px solid var(--border-color); }
footer p { font-family: var(--font-family-main); font-size: 0.9rem; color: var(--text-muted); margin-bottom: 5px; }
.theme-switcher { position: fixed; bottom: 20px; left: 20px; background-color: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color); width: 50px; height: 50px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; z-index: 1001; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

/* --- Admin Panel --- */
.admin-section { background-color: var(--card-bg); padding: 25px; border-radius: var(--border-radius); border: 1px solid var(--border-color); margin-bottom: 30px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }
.admin-header h1 { font-size: 1.5rem; color: var(--text-color); margin: 0; }
.admin-item { display: flex; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border-color); }
.admin-item:last-child { border-bottom: none; }
.admin-item span { flex-grow: 1; font-weight: 600; }
.admin-item .actions { display: flex; gap: 10px; }
.admin-item .actions button { padding: 8px 12px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; }

/* --- Forms & Dialog --- */
dialog { background: var(--card-bg); color: var(--text-color); border-radius: var(--border-radius); border: 1px solid var(--border-color); padding: 30px; width: 90%; max-width: 700px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-muted); }
.form-control { width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); border-radius: 8px; font-family: inherit; font-size: 1rem; background-color: var(--app-bg); color: var(--text-color); transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25); }
.dialog-actions { margin-top: 30px; display: flex; gap: 10px; justify-content: flex-end; }
.current-images-container { display: flex; flex-wrap: wrap; gap: 10px; border: 1px solid var(--border-color); padding: 10px; border-radius: 8px; min-height: 80px; }
.current-image-item { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--text-muted); position: relative; }
.current-image-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
.remove-image-btn { position: absolute; top: -5px; right: -5px; background-color: var(--danger-color); color: white; border-radius: 50%; width: 20px; height: 20px; border: none; cursor: pointer; font-size: 12px; line-height: 20px; text-align: center; }

/* --- PWA & Notification Styles --- */
#install-container {
    position: fixed;
    bottom: 80px; /* Above theme switcher */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
}
#install-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    display: none; /* Hidden by default */
}
#notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1003;
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateY(200%);
    transition: transform 0.5s ease-in-out;
}
#notification-toast.show {
    transform: translateY(0);
}
#notification-toast a {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
}
#notification-toast .close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .nav-menu { display: none; }
}