/* Nextsun ERP System Styles */
* { box-sizing: border-box; }

.nextsun-erp-wrapper {
    display: flex;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f6fa;
    margin: 0;
}

/* Sidebar */
.nextsun-sidebar {
    width: 240px;
    min-width: 240px;
    background: #3e3f3c;
    color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nextsun-brand {
    padding: 20px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    letter-spacing: 0.5px;
}
.nextsun-nav { padding: 8px 0; flex: 1; overflow-y: auto; }
.nextsun-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #b0b8c8;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.nextsun-nav-item:hover, .nextsun-nav-item.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}
.nextsun-nav-item .nav-icon { margin-right: 10px; font-size: 16px; }
.nextsun-nav-item .nav-arrow { margin-left: auto; font-size: 10px; }
.nextsun-nav-sub { display: none; background: rgba(0,0,0,0.2); }
.nextsun-nav-sub.open { display: block; }
.nextsun-nav-sub-item {
    display: block;
    padding: 8px 16px 8px 46px;
    color: #8a94a6;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
}
.nextsun-nav-sub-item:hover { color: #fff; text-decoration: none; }

/* Main Content */
.nextsun-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}
.nextsun-topbar {
    background: #fff;
    padding: 12px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    border-bottom: 1px solid #e8ecf0;
    font-size: 13px;
    color: #666;
}
.nextsun-topbar span { cursor: pointer; }
.nextsun-content-area { padding: 24px 30px; flex: 1; }

/* Breadcrumb */
.nextsun-breadcrumb {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
}

/* Section Header */
.nextsun-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.nextsun-section-title { font-size: 20px; font-weight: 600; color: #3fa0ff; }

/* Buttons */
.nextsun-btn-primary {
    background: #3fa0ff;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.nextsun-btn-primary:hover { background: #2d3548; }
.nextsun-btn-secondary {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #1a1a1a;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.nextsun-btn-secondary:hover { background: #333; }

/* Search Bar */
.nextsun-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Inputs */
.nextsun-input {
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #333;
    background: #fff;
    width: 100%;
    outline: none;
    transition: border 0.2s;
}
.nextsun-input:focus { border-color: #3e3f3c; }
.nextsun-select {
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #333;
    background: #fff;
    width: 100%;
    outline: none;
}
.nextsun-textarea {
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #333;
    background: #fff;
    width: 100%;
    min-height: 100px;
    outline: none;
    resize: vertical;
}

/* Status Tabs */
.nextsun-status-tabs, .nextsun-report-period {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.nextsun-tab {
    background: #fff;
    border: 1px solid #d0d5dd;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}
.nextsun-tab.active, .nextsun-tab:hover {
    background: #3e3f3c;
    color: #fff;
    border-color: #3e3f3c;
}

/* Table */
.nextsun-table-wrapper {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.nextsun-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.nextsun-table th {
    background: #f8f9fb;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #e8ecf0;
    white-space: nowrap;
}
.nextsun-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    color: #333;
    vertical-align: middle;
}
.nextsun-table tr:last-child td { border-bottom: none; }
.nextsun-table tr:hover td { background: #f8f9fb; }
.nextsun-loading, .nextsun-empty { text-align: center; color: #999; padding: 30px !important; }

/* Action Links */
.nextsun-actions { white-space: nowrap; }
.nextsun-link-view { color: #bed886; text-decoration: none; margin-right: 8px; font-size: 12px; }
.nextsun-link-edit { color: #0066cc; text-decoration: none; margin-right: 8px; font-size: 12px; }
.nextsun-link-delete { color: #e53935; text-decoration: none; font-size: 12px; }
.nextsun-link-view:hover, .nextsun-link-edit:hover { text-decoration: underline; }

/* Status Badge */
.nextsun-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.status-unpaid { background: #fff3e0; color: #e65100; }
.status-unfulfilled { background: #e3f2fd; color: #1565c0; }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-cancelled { background: #fce4ec; color: #c62828; }

/* Cards */
.nextsun-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 16px;
    overflow: hidden;
}
.nextsun-card-header {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #3e3f3c;
    border-bottom: 1px solid #f0f2f5;
    background: #f8f9fb;
}
.nextsun-card-body { padding: 20px; }

/* Form Layout */
.nextsun-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.nextsun-form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 16px;
}
.nextsun-form-group.full-width { flex: 100%; }
.nextsun-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

/* Two Column Layout */
.nextsun-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Modal */
.nextsun-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nextsun-modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.nextsun-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e8ecf0;
}
.nextsun-modal-header h3 { margin: 0; font-size: 16px; }
.nextsun-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}
.nextsun-modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* Product Tabs */
.nextsun-product-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e8ecf0;
    padding: 0 20px;
    background: #f8f9fb;
}
.nextsun-product-tabs .nextsun-tab {
    border-radius: 0;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 12px 20px;
    background: none;
    color: #666;
}
.nextsun-product-tabs .nextsun-tab.active {
    background: none;
    color: #3e3f3c;
    border-bottom-color: #3e3f3c;
}
.nextsun-tab-content { padding: 20px; }

/* Inventory */
.nextsun-understocking { color: #e53935; font-weight: 600; }
.nextsun-no-image {
    width: 50px; height: 50px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 20px;
    color: #ccc;
}

/* Charts */
.nextsun-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.nextsun-chart-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.nextsun-chart-title {
    font-size: 14px;
    font-weight: 600;
    color: #3e3f3c;
    margin-bottom: 16px;
}

/* Category Filter */
.nextsun-cat-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.nextsun-cat-tag {
    background: #f0f2f5;
    border: 1px solid #d0d5dd;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
}
.nextsun-cat-tag.active, .nextsun-cat-tag:hover {
    background: #3e3f3c;
    color: #fff;
    border-color: #3e3f3c;
}

/* Checkbox Label */
.nextsun-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    cursor: pointer;
}

/* Hint text */
.nextsun-hint { font-size: 12px; color: #888; margin-bottom: 16px; }

/* Responsive */
@media (max-width: 768px) {
    .nextsun-erp-wrapper { flex-direction: column; }
    .nextsun-sidebar { width: 100%; min-height: auto; position: relative; }
    .nextsun-two-col { grid-template-columns: 1fr; }
    .nextsun-form-group { min-width: 100%; }
}

/* Hide WordPress default page title on ERP pages */
.nextsun-erp-wrapper ~ .entry-title,
.nextsun-erp-wrapper + .entry-title { display: none; }


/* Dashboard Stats Cards */
.nextsun-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.nextsun-stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid #e8ecf0;
}
.nextsun-stat-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4ff;
    border-radius: 8px;
}
.nextsun-stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}
.nextsun-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #3e3f3c;
}

/* Quick Access Buttons */
.nextsun-quick-access {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.nextsun-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    color: #3e3f3c;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s;
}
.nextsun-quick-btn:hover {
    background: #3e3f3c;
    color: #fff;
    border-color: #3e3f3c;
    text-decoration: none;
}

/* ===== Hide WordPress theme header/footer on ERP pages ===== */
body.nextsun-erp-page #masthead,
body.nextsun-erp-page .site-header,
body.nextsun-erp-page header.site-header,
body.nextsun-erp-page .ast-desktop-header,
body.nextsun-erp-page .ast-mobile-header,
body.nextsun-erp-page .ast-above-header-wrap,
body.nextsun-erp-page .ast-below-header-wrap,
body.nextsun-erp-page #colophon,
body.nextsun-erp-page .site-footer,
body.nextsun-erp-page footer.site-footer,
body.nextsun-erp-page .ast-breadcrumbs-wrapper {
    display: none !important;
}
body.nextsun-erp-page .site-content,
body.nextsun-erp-page #content,
body.nextsun-erp-page .ast-container,
body.nextsun-erp-page .entry-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}
body.nextsun-erp-page {
    background: #f5f6fa !important;
}


/* Manus fix: sidebar color, readonly fields, and PDF button readability */
.nextsun-sidebar{background:#3e3f3c !important;}
button[onclick*="nextsunDownloadOrderPdf"],a[onclick*="nextsunDownloadOrderPdf"],#nextsun-download-order-pdf,.nextsun-download-pdf{background:#ffffff !important;background-image:none !important;color:#111827 !important;border:1px solid #d1d5db !important;box-shadow:none !important;}
button[onclick*="nextsunDownloadOrderPdf"]:hover,a[onclick*="nextsunDownloadOrderPdf"]:hover,#nextsun-download-order-pdf:hover,.nextsun-download-pdf:hover{background:#f9fafb !important;color:#111827 !important;}
#of-client-display[readonly],#of-amount[readonly]{background:#f3f4f6 !important;color:#6b7280 !important;}
