/* ===== AFH THEME STYLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background: #fcfcfc;
    color: #1a1a1a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; width: 100%;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; width: 100%; box-sizing: border-box; }
h1, h2, h3, h4, p, a, span, strong, div, label, input, select, textarea {
    word-break: break-word; overflow-wrap: break-word;
}

/* ===== HEADER ===== */
.admin-header {
    background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1rem 0; position: sticky; top: 0; z-index: 100; width: 100%;
}
.header-inner {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem;
}
.logo { display: flex; align-items: baseline; gap: 4px; font-family: 'Playfair Display', serif; }
.logo__text { font-size: 1.8rem; font-weight: 700; color: #1a1a1a; }
.logo__sub { font-size: 0.9rem; font-weight: 400; color: #666; letter-spacing: 1px; }

.btn {
    display: inline-block; padding: 0.75rem 2rem; border-radius: 30px;
    font-weight: 600; font-size: 0.95rem; cursor: pointer;
    border: 2px solid transparent; transition: all 0.3s ease; text-align: center;
}
.btn--primary { background: #2c2c2c; color: #fff; border-color: #2c2c2c; }
.btn--primary:hover { background: #000; border-color: #000; transform: translateY(-2px); }
.btn--outline { background: transparent; color: #2c2c2c; border-color: #2c2c2c; }
.btn--outline:hover { background: #2c2c2c; color: #fff; transform: translateY(-2px); }

#auth-section { flex: 1; display: flex; justify-content: center; align-items: center; padding: 4rem 0; width: 100%; }
.auth-card {
    background: #fff; padding: 3rem 4rem; border-radius: 30px; text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08); max-width: 450px; width: 100%; margin: 0 1rem;
}
.auth-card h2 { font-family: 'Playfair Display', serif; font-size: 2rem; margin-bottom: 0.5rem; color: #1a1a1a; }
.auth-card p { color: #777; margin-bottom: 1.5rem; }
.auth-card .btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.75rem; }
.auth-card i { font-size: 1.2rem; }

/* ===== DASHBOARD SIDEBAR LAYOUT ===== */
#dashboard-section { display: none; padding: 2rem 0 4rem; width: 100%; }
.admin-greeting { font-family: 'Playfair Display', serif; font-size: 1.8rem; margin-bottom: 1.5rem; }
.admin-greeting span { color: #a67c52; }
.admin-layout { display: grid; grid-template-columns: 260px 1fr; gap: 2.5rem; align-items: start; width: 100%; }

.admin-sidebar {
    background: #fff; border-radius: 20px; padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #eee;
    position: sticky; top: 100px; width: 100%;
}
.user-avatar {
    width: 60px; height: 60px; background: #2c2c2c; color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 600; margin: 0 auto 1rem;
}
.user-sidebar-name { text-align: center; font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; margin-bottom: 2rem; }

.sidebar-menu { display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-menu button {
    background: none; border: none; width: 100%; text-align: left; padding: 0.8rem 1rem;
    border-radius: 12px; font-size: 0.95rem; color: #555; cursor: pointer; transition: 0.2s;
    font-family: 'Inter', sans-serif; display: flex; align-items: center; gap: 0.8rem;
}
.sidebar-menu button:hover { background: #f5f5f5; color: #000; }
.sidebar-menu button.active { background: #2c2c2c; color: #fff; }

.admin-content {
    background: #fff; border-radius: 20px; padding: 2.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #eee; min-height: 400px; width: 100%;
}
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== ADMIN FORM STYLES ===== */
.form-group { margin-bottom: 1rem; width: 100%; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; color: #333; }
.form-group input, .form-group select, .form-group textarea,
.bulk-item-card input[type="text"], .bulk-item-card input[type="number"], .bulk-item-card textarea {
    width: 100%; padding: 0.75rem 1rem; border: 1px solid #ddd; border-radius: 12px;
    font-family: 'Inter', sans-serif; font-size: 1rem; background: #fff; transition: border 0.3s; resize: vertical;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.bulk-item-card input[type="text"]:focus, .bulk-item-card input[type="number"]:focus, .bulk-item-card textarea:focus {
    border-color: #a67c52; outline: none;
}
.form-group input[type="file"] { position: absolute; opacity: 0; width: 0; height: 0; z-index: -1; }
.file-upload-wrapper { position: relative; width: 100%; }
.file-upload-label {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 2px dashed #bbb; border-radius: 16px; background: #fafafa; padding: 1.5rem 1rem;
    cursor: pointer; transition: all 0.3s ease; color: #555; text-align: center;
}
.file-upload-label:hover { border-color: #a67c52; background: #fcf5f0; }
.file-upload-label i { font-size: 2rem; color: #a67c52; margin-bottom: 0.3rem; }
.file-upload-text { font-weight: 600; font-size: 0.95rem; }
.file-upload-info { font-size: 0.8rem; color: #999; margin-top: 0.2rem; }
.file-name { display: block; margin-top: 0.5rem; font-size: 0.85rem; font-weight: 600; color: #2c2c2c; background: #eee; padding: 0.2rem 0.8rem; border-radius: 20px; }

/* ===== BULK SETUP & CATEGORIES ===== */
.setup-guide { display: flex; flex-direction: column; gap: 1.5rem; width: 100%; }
.upload-zone {
    border: 2px dashed #a67c52; background: #fcf5f0; border-radius: 20px; padding: 3rem 1rem;
    text-align: center; cursor: pointer; transition: 0.3s;
}
.upload-zone:hover { background: #f5e6d8; }
.upload-zone input { display: none; }
.upload-zone i { font-size: 3rem; color: #a67c52; margin-bottom: 0.5rem; }
.bulk-products-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; max-height: 500px; overflow-y: auto; padding-right: 0.5rem; }
.bulk-item-card {
    background: #fff; border: 1px solid #eee; border-radius: 16px; padding: 1rem;
    display: flex; flex-direction: column; gap: 0.8rem; box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.bulk-item-card .img-wrap { position: relative; border-radius: 12px; overflow: hidden; height: 150px; }
.bulk-item-card img { width: 100%; height: 100%; object-fit: cover; }
.bulk-item-card .remove-item-btn {
    position: absolute; top: 8px; right: 8px; background: rgba(220, 53, 69, 0.85);
    color: #fff; border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; transition: 0.2s; z-index: 5;
}
.bulk-item-card .remove-item-btn:hover { background: #dc3545; transform: scale(1.1); }
.opt-label { font-size: 0.8rem; color: #888; display: block; margin-bottom: 0.2rem; }
.cat-checkboxes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.2rem; }
.cat-checkboxes label {
    background: #f0f0f0; padding: 0.2rem 0.8rem; border-radius: 20px; font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 0.3rem; white-space: nowrap;
}
.cat-checkboxes input { margin: 0; cursor: pointer; }
.cat-checkboxes label:has(input:checked) { background: #a67c52; color: #fff; }
.cat-tag { background: #f0f0f0; padding: 0.3rem 1rem; border-radius: 20px; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.cat-tag .del-cat { cursor: pointer; color: #dc3545; font-size: 0.8rem; }
.category-row { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

/* ===== PRODUCT LIST ===== */
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 2px solid #f0f0f0; padding-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.product-list-item {
    background: #f9f9f9; border-radius: 12px; padding: 1rem; margin-bottom: 1rem;
    display: flex; justify-content: space-between; align-items: center; border: 1px solid #eee; transition: 0.2s;
}
.product-list-item:hover { background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.item-info { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; }
.item-img-wrap { flex-shrink: 0; width: 60px; height: 60px; border-radius: 8px; overflow: hidden; border: 1px solid #eee; }
.item-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.item-details-wrap { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.item-details-wrap h4 { font-size: 1rem; margin-bottom: 0.1rem; }
.item-meta-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.1rem 0 0.2rem 0; }
.item-price { color: #a67c52; font-weight: 700; }
.item-cats { font-size: 0.75rem; color: #888; }
.item-actions button { background: none; border: none; cursor: pointer; padding: 0.4rem 0.8rem; border-radius: 8px; transition: 0.2s; font-size: 1rem; margin-left: 0.3rem; }
.btn-delete { color: #dc3545; }
.btn-delete:hover { background: #fce4e4; }
.btn-edit { color: #2c2c2c; }
.btn-edit:hover { background: #eaeaea; }

/* ===== MODALS ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; z-index: 9999; }
.modal-content {
    background: #fff; max-width: 450px; width: 95%; padding: 2.5rem; border-radius: 30px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3); position: relative; text-align: left; max-height: 90vh; overflow-y: auto;
}
@media (min-width: 992px) { .modal-content { max-width: 750px; width: 80%; } }
.modal-content h3 { font-family: 'Playfair Display', serif; font-size: 1.5rem; margin-bottom: 1.5rem; }
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; color: #888; cursor: pointer; transition: 0.3s; }
.close-modal:hover { color: #000; }
.img-preview-container { text-align: center; margin-bottom: 1rem; }
.img-preview-container img { max-width: 100%; max-height: 150px; border-radius: 12px; border: 1px solid #ddd; }

.step-row { padding: 0.5rem 0; font-size: 1rem; display: flex; align-items: center; gap: 0.8rem; color: #888; }
.step-row.active { color: #1a1a1a; font-weight: 600; }
.step-row.completed { color: #25D366; }
.step-row.error { color: #dc3545; font-weight: 600; }
.step-icon { width: 1.5rem; text-align: center; }
.val-error-item { color: #dc3545; margin: 0.3rem 0; font-weight: 500; }
#addMoreProductsBtn { display: none; cursor: pointer; color: #a67c52; font-weight: 500; text-align: center; }
#addMoreProductsBtn:hover { text-decoration: underline; }

/* ===== ADMIN ORDERS TABLE ===== */
.admin-orders-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; border: 1px solid #eee; background: #fff; }
.admin-orders-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 800px; }
.admin-orders-table th { text-align: left; padding: 1.2rem 1rem; background: #fafafa; color: #666; font-weight: 600; border-bottom: 2px solid #eee; }
.admin-orders-table td { padding: 1rem; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.admin-orders-table tr:last-child td { border-bottom: none; }
.order-td-code { font-weight: 700; color: #a67c52; letter-spacing: 0.5px; }
.order-td-customer { font-size: 0.85rem; color: #555; }
.order-control-group { display: flex; flex-direction: column; gap: 0.3rem; min-width: 120px; }
.order-select, .order-input { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid #ddd; border-radius: 10px; font-size: 0.8rem; font-family: 'Inter', sans-serif; background: #fff; transition: 0.2s; color: #1a1a1a !important; }
.order-select:focus, .order-input:focus { border-color: #a67c52; outline: none; }
.status-badge { display: inline-block; padding: 0.2rem 0.8rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; color: #fff; }
.status-badge.pending, .status-badge.verifying { background: #ffc107; }
.status-badge.processing { background: #17a2b8; }
.status-badge.shipped { background: #007bff; }
.status-badge.delivered, .status-badge.verified { background: #25D366; }
.status-badge.default { background: #6c757d; }
.order-update-btn { background: #2c2c2c; color: #fff; border: none; padding: 0.4rem 1rem; border-radius: 30px; cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 0.3rem; }
.order-update-btn:hover { background: #000; }
.order-end-btn { background: transparent; border: 1px solid #dc3545; color: #dc3545; padding: 0.3rem 1rem; border-radius: 20px; cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: 0.2s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .admin-sidebar { position: static; }
    .sidebar-menu { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
    .sidebar-menu button { flex: 1; justify-content: center; text-align: center; min-width: 80px; }
    .admin-content { padding: 1.5rem; }
    .bulk-products-grid { grid-template-columns: 1fr; }
    .admin-orders-table-wrap { border-radius: 0; border: none; margin: 0 -1rem; width: calc(100% + 2rem); padding: 0 1rem; }
    .admin-orders-table { min-width: 700px; }
    .admin-header .header-inner { justify-content: center; gap: 0.5rem; }
    .admin-header .logo { text-align: center; flex: 1 1 100%; }
    .admin-header #user-actions { flex: 1 1 100%; justify-content: center; }
}
@media (max-width: 480px) {
    .admin-sidebar { padding: 1.5rem; }
    .sidebar-menu button { flex: 1 1 100%; min-width: unset; }
    .admin-content { padding: 1rem; }
}
