/* Admin Dashboard Styles */

/* Admin Content */
.admin-content {
    padding-top: 120px;
    padding-bottom: 50px;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header h1 {
    color: rgb(35, 130, 240);
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-header h1 i {
    font-size: 32px;
}

/* Admin Welcome Section */
.admin-welcome {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-welcome h1 {
    font-size: 24px;
    color: #333;
    margin: 0;
}

.admin-welcome h1 span {
    color: rgb(35, 130, 240);
}

.admin-role-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, rgb(35, 130, 240), rgb(25, 100, 200));
    width: fit-content;
}

@media (max-width: 768px) {
    .admin-welcome {
        text-align: center;
        align-items: center;
    }

    .admin-welcome h1 {
        font-size: 20px;
    }

    .admin-role-badge {
        margin: 0 auto;
    }
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 15px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    min-width: 200px;
}

.search-box:focus-within {
    border-color: rgb(35, 130, 240);
    box-shadow: 0 0 0 3px rgba(35, 130, 240, 0.1);
}

.search-box i {
    color: rgb(35, 130, 240);
    font-size: 18px;
}

.search-box input {
    border: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    outline: none;
    width: 100%;
}

.search-box input::placeholder {
    color: #999;
}

/* Filter Dropdown */
.filter-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 15px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.filter-dropdown:hover {
    border-color: rgb(35, 130, 240);
}

.filter-dropdown label {
    color: rgb(35, 130, 240);
    font-size: 18px;
    display: flex;
    align-items: center;
}

.filter-dropdown select {
    border: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    outline: none;
    padding-right: 10px;
}

/* Add Product Button */
.btn-add-product {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgb(35, 130, 240), rgb(25, 100, 200));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(35, 130, 240, 0.3);
}

.btn-add-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(35, 130, 240, 0.4);
}

.btn-add-product i {
    font-size: 18px;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    overflow-x: auto;
}

/* Product Table */
.product-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.product-table thead {
    background: linear-gradient(135deg, rgb(35, 130, 240), rgb(25, 100, 200));
    color: white;
}

.product-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.product-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.product-table tbody tr:hover {
    background-color: #f8fafc;
}

.product-table td {
    padding: 12px;
    font-size: 14px;
    vertical-align: middle;
}

.product-table .product-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #f0f0f0;
}

.product-table .product-name {
    font-weight: 600;
    color: #333;
}

.product-table .product-price {
    color: rgb(35, 130, 240);
    font-weight: 700;
}

.product-table .product-category {
    background: #e3f2fd;
    color: rgb(35, 130, 240);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-transform: capitalize;
}

.product-table .status-active {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.product-table .status-disabled {
    background: #ffebee;
    color: #c62828;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-edit,
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
}

.btn-edit {
    background: #e3f2fd;
    color: rgb(35, 130, 240);
}

.btn-edit:hover {
    background: rgb(35, 130, 240);
    color: white;
}

.btn-delete {
    background: #ffebee;
    color: #e74c3c;
}

.btn-delete:hover {
    background: #e74c3c;
    color: white;
}

/* Modal Scrollable */
.modal-overlay {
    overflow-y: auto;
    padding: 20px;
}

.modal-content.modal-form {
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    text-align: left;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-size: 20px;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 0;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
}

.btn-close-modal:hover {
    background: #f0f0f0;
    color: #333;
}

/* Input with Prefix (Rupiah) */
.input-with-prefix {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.input-with-prefix:focus-within {
    border-color: rgb(35, 130, 240);
    box-shadow: 0 0 0 3px rgba(35, 130, 240, 0.1);
}

.input-prefix {
    background: #f5f5f5;
    padding: 10px 14px;
    font-weight: 600;
    color: #666;
    font-size: 14px;
    border-right: 2px solid #e0e0e0;
}

.input-with-prefix input {
    border: none !important;
    border-radius: 0 !important;
    flex: 1;
}

.input-with-prefix input:focus {
    box-shadow: none !important;
}

.input-hint {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* Image Upload */
.image-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.image-preview {
    width: 150px;
    height: 150px;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fafafa;
}

.image-preview:hover {
    border-color: rgb(35, 130, 240);
    background: #f0f7ff;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #999;
    font-size: 12px;
}

.preview-placeholder i {
    font-size: 32px;
    color: rgb(35, 130, 240);
}

.file-input {
    display: none;
}

.upload-hint {
    font-size: 11px;
    color: #999;
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 13px;
}

.form-group label i {
    color: rgb(35, 130, 240);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgb(35, 130, 240);
    box-shadow: 0 0 0 3px rgba(35, 130, 240, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #aaa;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-checkbox {
    display: flex;
    align-items: center;
}

.form-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: rgb(35, 130, 240);
}

.modal-buttons {
    flex-shrink: 0;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

/* Delete Confirm Button */
.btn-delete-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    background: #e74c3c;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-delete-confirm:hover {
    background: #c0392b;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(39, 174, 96, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.3);
}

.toast i {
    font-size: 20px;
}

/* Undo Toast */
.toast.undo-toast {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 5px 20px rgba(243, 156, 18, 0.3);
}

.btn-undo {
    background: white;
    color: #e67e22;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.btn-undo:hover {
    background: #fff5e6;
    transform: scale(1.05);
}

/* Active nav link */
.nav-link.active {
    color: rgb(35, 130, 240);
    font-weight: 600;
}

/* Menu Logout Item */
.menu-logout {
    margin-left: auto;
}

.menu-logout .btn-logout {
    background: #ffebee;
    color: #c62828;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.menu-logout .btn-logout:hover {
    background: #c62828;
    color: white;
}

@media (max-width: 768px) {
    .menu-logout {
        margin-left: 0;
        margin-top: 15px;
    }

    .menu-logout .btn-logout {
        background: white;
        color: #c62828;
        padding: 12px 30px;
        font-size: 14px;
    }
}

/* Admin Navbar Layout */
body:has(.admin-content) .navbar-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

body:has(.admin-content) .navbar-box .admin-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 40px;
    margin: 0;
}

body:has(.admin-content) .navbar-box .admin-menu li a {
    font-size: 14px;
    font-weight: 500;
    color: #444;
    padding: 8px 0;
}

body:has(.admin-content) .navbar-box .admin-menu li a:hover {
    color: rgb(35, 130, 240);
}

body:has(.admin-content) .navbar-box .admin-menu li a.nav-link.active {
    color: rgb(35, 130, 240);
    font-weight: 600;
}

/* Logout button on the right */
.btn-logout-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.btn-logout-nav:hover {
    background: #e74c3c;
    color: white;
}

/* Hide mobile logout on desktop */
.mobile-logout-item {
    display: none !important;
}

@media (max-width: 768px) {

    /* Show mobile logout in hamburger */
    .mobile-logout-item {
        display: block !important;
        margin-top: 10px;
    }

    body:has(.admin-content) .navbar-box .admin-menu {
        position: fixed;
        left: 0;
        top: -100%;
        transform: none;
        flex-direction: column;
        width: 100%;
        background: linear-gradient(135deg, rgb(35, 130, 240), rgb(25, 100, 200));
        padding: 35px 0;
        gap: 20px;
        z-index: 999;
        opacity: 0;
        transition: all 0.4s ease;
    }

    body:has(.admin-content) .navbar-box .admin-menu.menu-active {
        top: 70px;
        opacity: 1;
    }

    body:has(.admin-content) .navbar-box .admin-menu li a {
        color: white !important;
        font-size: 16px;
        text-decoration: none;
    }

    body:has(.admin-content) .navbar-box .admin-menu li a:hover {
        color: rgba(255, 255, 255, 0.8) !important;
    }

    body:has(.admin-content) .navbar-box .admin-menu li a.nav-link.active {
        color: white !important;
        font-weight: 700;
        text-decoration: underline;
        text-underline-offset: 5px;
    }

    .btn-logout-nav {
        display: none;
    }

    .btn-logout-mobile {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: white;
        color: #e74c3c;
        border: none;
        padding: 12px 30px;
        border-radius: 25px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .btn-logout-mobile:hover {
        background: #ffebee;
        color: #c62828;
    }
}

/* User Info in Navbar */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 15px;
}

#userNameDisplay {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.user-role {
    background: linear-gradient(135deg, rgb(35, 130, 240), rgb(25, 100, 200));
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #ffebee;
    color: #c62828;
    border: none;
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.btn-logout:hover {
    background: #c62828;
    color: white;
    transform: translateY(-1px);
}

/* Admin Modal Large */
.modal-large {
    max-width: 700px;
}

.admin-form-section,
.admin-list-section {
    margin-bottom: 25px;
}

.admin-form-section h3,
.admin-list-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgb(35, 130, 240);
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.admin-list-section .product-table {
    min-width: auto;
}

/* Role Badge Colors */
.role-super_admin {
    background: linear-gradient(135deg, #e91e63, #c2185b);
}

.role-syirkatuna {
    background: linear-gradient(135deg, #4caf50, #388e3c);
}

.role-umkm {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.role-affiliate {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.role-karya_santri {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
}

/* Button can't edit disabled */
.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn-disabled:hover {
    transform: none !important;
    background: inherit !important;
    color: inherit !important;
}

/* Responsive user info */
@media (max-width: 768px) {
    .navbar-box .user-info {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 12px 20px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        justify-content: center;
        margin: 0;
        gap: 15px;
    }

    .navbar-box .user-info #userNameDisplay {
        display: none;
    }

    .navbar-box .user-info .user-role {
        font-size: 12px;
        padding: 6px 15px;
    }

    .navbar-box .user-info .btn-logout {
        padding: 10px 20px;
    }
}

/* Loading and Error states */
.loading-text,
.error-text {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.error-text {
    color: #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        text-align: center;
    }

    .admin-header h1 {
        font-size: 22px;
    }

    .header-actions {
        justify-content: center;
        gap: 10px;
    }

    .filter-dropdown {
        padding: 6px 12px;
    }

    .filter-dropdown select {
        font-size: 12px;
    }

    .btn-add-product {
        padding: 10px 16px;
        font-size: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content.modal-form {
        padding: 20px;
        max-height: 85vh;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .btn-modal-close,
    .btn-modal-pesan,
    .btn-delete-confirm {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }

    .btn-edit,
    .btn-delete {
        padding: 6px 10px;
        font-size: 11px;
    }

    .product-table .product-img {
        width: 45px;
        height: 45px;
    }

    .product-table th,
    .product-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .admin-content {
        padding-top: 100px;
    }

    .admin-header h1 {
        font-size: 18px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .search-box {
        width: 100%;
        min-width: auto;
        margin-bottom: 10px;
    }

    .filter-dropdown {
        padding: 5px 10px;
        flex: 1;
    }

    .filter-dropdown select {
        font-size: 11px;
        width: 100%;
    }

    .btn-add-product {
        padding: 8px 12px;
        font-size: 11px;
        flex-shrink: 0;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-content.modal-form {
        padding: 15px;
    }
}

/* Role Checkboxes */
.role-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    border: 2px solid transparent;
}

.role-checkbox:hover {
    background: #e3f2fd;
    border-color: rgb(35, 130, 240);
}

.role-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: rgb(35, 130, 240);
}

.role-checkbox input[type="checkbox"]:checked+span {
    color: rgb(35, 130, 240);
    font-weight: 600;
}

/* Multi-role badge styling */
.role-multi {
    background: linear-gradient(135deg, rgb(35, 130, 240), #9c27b0, #ff9800) !important;
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Checkbox Column */
.checkbox-col {
    width: 40px;
    text-align: center;
}

.checkbox-col input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: rgb(35, 130, 240);
}

/* Delete Selected Button */
.btn-delete-selected {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-delete-selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-delete-selected i {
    font-size: 18px;
}

/* Responsive checkbox */
@media (max-width: 768px) {
    .checkbox-col {
        width: 30px;
    }

    .checkbox-col input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .btn-delete-selected {
        padding: 10px 16px;
        font-size: 12px;
    }
}