/**
 * Minimal Reusable PDF Optimizer Stylesheet
 * Designed to inherit from the parent theme seamlessly.
 */

.shipment-pdf-optimizer {
	max-width: 1200px;
	width: 100%;
	margin: 0 auto;
	font-family: 'Roboto', sans-serif;
	color: inherit;
	background: transparent;
	line-height: 1.5;
	padding: 0 15px;
	box-sizing: border-box;
}

/* Amazon Theme (Default) */
.shipment-pdf-optimizer,
.shipment-pdf-optimizer.theme-amazon {
    --po-primary: var(--theme-button-background-initial-color, var(--theme-palette-color-1, #ffd800));
    --po-primary-hover: var(--theme-button-background-hover-color, var(--theme-palette-color-2, #ffc900));
    --po-text: var(--theme-button-text-initial-color, #2f2207);
    --po-process: var(--po-primary);
    --po-process-hover: var(--po-primary-hover);
    --po-process-text: var(--po-text);
}

/* Flipkart Theme */
.shipment-pdf-optimizer.theme-flipkart {
    --po-primary: #2563eb;
    --po-primary-hover: #1d4ed8;
    --po-text: #ffffff;
    --po-process: #9333ea;
    --po-process-hover: #7e22ce;
    --po-process-text: #ffffff;
}

/* Meesho Theme (Fallback) */
.shipment-pdf-optimizer.theme-meesho {
    --po-primary: #ec4899;
    --po-primary-hover: #db2777;
    --po-text: #ffffff;
    --po-process: #ec4899;
    --po-process-hover: #db2777;
    --po-process-text: #ffffff;
}

.shipment-pdf-optimizer * {
	box-sizing: border-box;
}

/* Header & Breadcrumbs */
.po-header-area {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
	gap: 1rem;
}

.po-breadcrumbs {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	color: var(--theme-palette-color-3, #5a5a5a);
}

.po-breadcrumbs strong {
	color: var(--theme-palette-color-4, #000000);
}

.platform-tabs-container {
	margin-bottom: 2rem;
}

.platform-tabs {
	display: flex;
	justify-content: flex-start;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.platform-tab {
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 15px;
	padding: 5px 20px;
	min-height: 42px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: #4b5563;
	transition: all 0.2s ease;
}

.platform-tab:hover {
	background: #f9fafb;
	border-color: #9ca3af;
}

.platform-tab.active[data-platform="amazon"] {
	border-color: #ffd800;
	background: #fffbeb;
	color: #000000;
}

.platform-tab.active[data-platform="meesho"] {
	border-color: #ec4899;
	background: #fdf2f8;
	color: #db2777;
}

.platform-tab.active[data-platform="flipkart"] {
	border-color: #3b82f6;
	background: #eff6ff;
	color: #2563eb;
}

.tab-icon {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	color: #fff;
	font-size: 0.75rem;
}

.tab-icon img {
	max-width: 100%;
	height: auto;
}

.platform-tab[data-platform="meesho"] .tab-icon {
	background: #ec4899;
	color: #fff;
}

.platform-tab[data-platform="flipkart"] .tab-icon {
	background: #3b82f6;
	color: #fff;
}

.security-badges {
	display: flex;
	justify-content: flex-start;
	flex-wrap: wrap;
	gap: 0.5rem;
	font-size: 0.8rem;
}

.security-badges .badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 99px;
	font-weight: 600;
}

.badge-green {
	background: #ecfdf5;
	color: #059669;
	border: 1px solid #a7f3d0;
}

.badge-blue {
	background: #eff6ff;
	color: #2563eb;
	border: 1px solid #bfdbfe;
}

.badge-purple {
	background: #f5f3ff;
	color: #7c3aed;
	border: 1px solid #ddd6fe;
}

/* Grid Layout */
.optimizer-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1.5rem;
}

.optimizer-col {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

/* Common Cards */
.settings-card,
.recent-card,
.drag-drop-zone,
.file-queue-container {
	background: #ffffff;
	border: 1px solid var(--theme-palette-color-5, #edeff2);
	border-radius: 15px;
	padding: 1.5rem;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.section-title,
.recent-header h4 {
	font-size: 1rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--theme-palette-color-4, #000000);
	margin: 0 0 1rem 0;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--theme-palette-color-5, #edeff2);
}

/* Upload Area */
.drag-drop-zone {
	background: var(--theme-palette-color-6, #f9fafb);
	border: 2px dashed #d1d5db;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 200px;
}

.drag-drop-zone:hover,
.drag-drop-zone.dragover {
	border-color: var(--po-primary);
	background: #f0f9ff;
}

.upload-icon-wrapper {
	font-size: 0.85rem;
	color: var(--theme-palette-color-3, #5a5a5a);
	margin-bottom: 0.5rem;
	text-transform: uppercase;
	font-weight: bold;
}

.drag-drop-zone h3 {
	margin: 0 0 0.5rem 0;
	font-size: 1.1rem;
	color: #111827;
}

.drag-drop-zone p {
	margin: 0 0 1.25rem 0;
	font-size: 0.85rem;
	color: #6b7280;
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--theme-button-padding, 5px 20px);
	border-radius: var(--theme-button-border-radius, 15px);
	font-weight: var(--theme-button-font-weight, 500);
	font-size: var(--theme-button-font-size, 15px);
	min-height: var(--theme-button-min-height, 50px);
	cursor: pointer;
	border: var(--theme-button-border, none);
	box-shadow: var(--theme-button-shadow, none);
	transform: var(--theme-button-transform, none);
	transition: all 0.2s ease;
	font-family: inherit;
	gap: 5px;
}

.btn-primary {
	background: var(--po-primary);
	color: var(--po-text);
	width: 100%;
}

.btn-process {
	background: var(--po-process);
	color: var(--po-process-text);
	width: 100%;
}

.btn-primary:hover,
.btn-process:hover {
	background: var(--po-process-hover);
	color: var(--po-process-text);
	opacity: 1;
}

.btn-process:disabled,
.btn-primary:disabled,
.btn:disabled {
	background: var(--theme-palette-color-5, #edeff2);
	color: var(--theme-palette-color-3, #5a5a5a);
	cursor: not-allowed;
	box-shadow: none;
}

.btn-outline {
	background: transparent;
	border: 2px solid var(--po-primary);
	color: var(--po-primary);
	width: 100%;
}

.btn-outline:hover {
	background: var(--theme-palette-color-5, #edeff2);
}

.action-buttons-group {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* Settings Form */

.setting-group h5 {
	font-size: 0.75rem;
	color: #6b7280;
	margin: 0 0 0.75rem 0;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.setting-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
	cursor: pointer;
}

.setting-item input[type="checkbox"] {
	margin-top: 0.25rem;
	width: 1rem;
	height: 1rem;
	accent-color: var(--po-process);
}

.setting-text {
	font-size: 0.9rem;
	color: #374151;
	line-height: 1.4;
}

.setting-text small {
	display: block;
	color: #6b7280;
	font-size: 0.75rem;
	margin-top: 0.1rem;
}

textarea#setting-filter-orders {
	width: 100%;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	padding: 0.75rem;
	font-size: 0.9rem;
	margin-top: 0.5rem;
	resize: vertical;
	min-height: 80px;
	font-family: inherit;
}

textarea#setting-filter-orders:focus {
	outline: none;
	border-color: var(--po-primary);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* File Queue */
.file-queue-container {
	margin-top: 1.5rem;
}

.file-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
	border: 1px solid var(--theme-palette-color-5, #edeff2);
	border-radius: 12px;
	margin-bottom: 0.75rem;
	background: #ffffff;
}

.file-item svg {
	flex-shrink: 0;
}

.file-name-block {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.file-name {
	font-size: 0.95rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--theme-palette-color-4, #000);
	font-weight: 600;
}

.file-meta {
	font-size: 0.8rem;
	color: var(--theme-palette-color-3, #5a5a5a);
	margin-top: 2px;
}

.btn-file-action {
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	cursor: pointer;
	color: #6b7280;
	padding: 0.4rem;
	border-radius: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.btn-file-action:hover {
	background: #fee2e2;
	color: #ef4444;
	border-color: #fca5a5;
}

.file-queue-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem;
	background: #f9fafb;
	border-radius: 12px;
	border: 1px solid var(--theme-palette-color-5, #edeff2);
	margin-top: 1rem;
}

#queue-status-text {
	font-size: 0.9rem;
	color: var(--theme-palette-color-3, #5a5a5a);
}

.btn-add-more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	border: 1px solid #d1d5db;
	color: #4b5563;
	padding: 6px 12px;
	border-radius: 99px;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
}

.btn-add-more:hover {
	background: #f3f4f6;
	color: #111827;
}

/* Recent Jobs */
.recent-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid var(--theme-palette-color-5, #edeff2);
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
}

.recent-header h4 {
	margin: 0;
	border-bottom: none;
	padding-bottom: 0;
}

.recent-header-meta {
	font-size: 0.8rem;
	color: var(--theme-palette-color-3, #5a5a5a);
}

.recent-item {
	padding: 1rem;
	border: 1px solid var(--theme-palette-color-5, #edeff2);
	border-radius: 12px;
	margin-bottom: 0.75rem;
	background: #ffffff;
	display: flex;
	align-items: center;
	gap: 1rem;
}

.recent-item-main {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.recent-item .file-name {
	color: var(--theme-palette-color-4, #000);
	font-weight: 700;
}

.recent-item-meta {
	font-size: 0.8rem;
	color: var(--theme-palette-color-3, #5a5a5a);
}

.btn-download-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: #eff6ff;
	color: #3b82f6;
	border-radius: 8px;
	text-decoration: none;
	transition: all 0.2s;
	border: 1px solid #bfdbfe;
}

.btn-download-icon:hover {
	background: #dbeafe;
	color: #2563eb;
}

/* Placeholder */
.no-files-placeholder {
	color: #9ca3af;
	text-align: center;
	padding: 2rem 0;
	font-size: 0.9rem;
}

/* Modals (Keep basic functionality if needed) */
.preview-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
}

.modal-content {
	position: relative;
	background: #fff;
	border-radius: 12px;
	width: 90%;
	max-width: 1000px;
	height: 85vh;
	display: flex;
	flex-direction: column;
	z-index: 1;
	overflow: hidden;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
	padding: 1rem;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.modal-body {
	padding: 1rem;
	flex: 1;
	overflow: auto;
	background: #f9fafb;
}

.modal-footer {
	padding: 1rem;
	border-top: 1px solid #e5e7eb;
	display: flex;
	justify-content: flex-end;
	gap: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
	.po-header-area {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.platform-tabs {
		flex-direction: column;
		width: 100%;
	}
	
	.platform-tab {
		width: 100%;
		justify-content: center;
	}
	
	.security-badges {
		justify-content: flex-start;
	}
	
	.optimizer-grid {
		grid-template-columns: 1fr;
	}
}