/* 1. Global Reset & Unified Layout */
* {
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}
.container {
    max-width: 900px !important;
    margin: 0 auto !important;
    padding: 0 20px;
}

/* 2. Header */
header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
    color: #000;
}
nav a {
    margin-left: 20px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
}

/* Search Form — updated per request */
.search-form {
    display: flex;
    align-items: center;
}
.search-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    /* Remove default arrow styling (optional but cleaner) */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23aaa' viewBox='0 0 16 16'%3E%3Cpath d='M7.002 11.001h1.996l3.683 2.698a1 1 0 0 0 1.405-1.405l-4.386-3.214a1 1 0 0 0-.595-.198V5.002a1 1 0 0 0-1.996 0v4.795a1 1 0 0 0 .595.198l4.386 3.214a1 1 0 0 0 1.405 1.405l-3.683-2.698H7.002a1 1 0 0 0 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    width: 120px;
}
.search-form input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 220px;
    margin: 0 8px;
}
.search-form button {
    padding: 8px 16px;
    background: #505050;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: normal;
}
.search-form button:hover {
    background: #333;
}

/* 3. Category Grid (Strict 4 Columns) */
.category-grid {
    display: grid !important;
    gap: 15px !important;
    grid-template-columns: repeat(4, 1fr) !important;
    margin-top: 20px;
}
@media (max-width: 600px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
.cat-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: block;
    text-decoration: none;
    background-color: #f0f0f0;
}
.cat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cat-info {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
}
.cat-name {
    display: block;
    font-weight: bold;
    font-size: 14px;
}
.cat-count {
    font-size: 11px;
    opacity: 0.8;
}

/* 4. Wallpaper Grid (Strict 3 Columns) */
.wallpaper-grid {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 600px) {
    .wallpaper-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
.wp-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.wp-card img {
    width: 100%;
    display: block;
}
.wp-title {
    padding: 10px;
    text-align: center;
    font-size: 13px;
    color: #333;
}

/* 5. Item Detail Layout */
.item-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 30px;
    justify-content: center;
    align-items: flex-start !important;
}
.item-image-box {
    flex: 0 0 320px;
    max-width: 100%;
    text-align: center;
}
.item-info-box {
    flex: 1;
    min-width: 300px;
    max-width: 480px;
}
.img-wrapper {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    line-height: 0;
    display: inline-block;
}
.main-wallpaper-preview {
    width: 100%;
    height: auto;
    display: block;
}
.preview-note {
    display: block;
    text-align: center;
    color: #999;
    font-size: 10px !important;
    margin-top: 10px;
}
h1 {
    font-size: 24px;
    margin: 0 0 15px 0 !important;
    line-height: 1.2;
    color: #111;
    padding-top: 0 !important;
}
.description {
    font-size: 14px;
    color: #555;
    margin-bottom: 20px;
    text-align: justify;
}
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}
.info-table td {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.info-table td:first-child {
    font-weight: bold;
    color: #888;
    width: 110px;
}

/* === NEW STYLES AS REQUESTED === */
/* Category link: bold, #505050, no underline */
.category-link {
    color: #505050;
    font-weight: bold;
    text-decoration: none;
}
.category-link:hover {
    text-decoration: none;
    color: #333;
}




/* Hashtag links: bold, #505050, no underline */

.hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px; /* horizontal gap = 6px, vertical gap = 8px */
    margin-bottom: 25px;
}

.hashtag-link {
    color: #505050;
    font-weight: bold;
    text-decoration: none;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    font-size: 12px;
    margin-right: 4px;
    display: inline-block;
}
.hashtag-link:hover {
    background: #e9ecef;
    color: #333;
}

/* Download Button: smaller, shorter, #505050 */
.download-btn {
    display: block;
    text-align: center;
    background: #505050;
    color: white;
    padding: 10px 24px; /* reduced from 15px → 10px height, 24px width */
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    margin-top: 16px;
}
.download-btn:hover {
    background: #333;
}

/* 6. Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 10px;
}
.page-link {
    padding: 8px 12px;
    background: #fff;
    color: #007bff;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.page-link.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Admin Panel Styles (unchanged, but kept for completeness) */
.admin-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
th {
    background: #f8f9fa;
}
.thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}
.status-1 {
    color: green;
    font-weight: bold;
}
.status-0 {
    color: #ccc;
}
.btn {
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    margin-right: 5px;
    display: inline-block;
}
.btn-edit {
    background: #ffc107;
    color: #000;
}
.btn-toggle {
    background: #6c757d;
    color: #fff;
}
.btn-delete {
    background: #dc3545;
    color: #fff;
}
.btn-add {
    background: #28a745;
    color: #fff;
    padding: 10px 20px;
    float: right;
}