/**
 * Dashboard Page Styles for 3D Scan & Show Plugin
 * 
 * Styles specific to the Dashboard page including:
 * - Header with search, sort, and filter controls
 * - Connection bar
 * - Plan and quota display
 * - Products section with tabs
 * - Products table
 * - Linked 3D model display
 */

/* ==========================================================================
   DASHBOARD HEADER - Search, Sort, Filter Controls
   ========================================================================== */

.stw-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 0;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.stw-header .stw-sort-name-btn,
.stw-header .stw-filter-btn {
	background: white;
	border: 1px solid var(--stw-border);
	color: var(--stw-dark);
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 500;
	border-radius: var(--stw-radius);
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	gap: 6px;
}

.stw-header .stw-sort-name-btn:hover,
.stw-header .stw-filter-btn:hover {
	background: var(--stw-light-gray);
	border-color: var(--stw-primary);
	color: var(--stw-primary);
}

.stw-header .stw-search-input {
	flex: 1;
	min-width: 250px;
	padding: 8px 14px;
	border: 1px solid var(--stw-border);
	border-radius: var(--stw-radius);
	font-size: 14px;
	background: white;
}

.stw-header .stw-search-input:focus {
	outline: none;
	border-color: var(--stw-primary);
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.stw-header .stw-more-menu {
	position: relative;
}

.stw-header .stw-more-btn {
	background: white;
	border: 1px solid var(--stw-border);
	color: var(--stw-dark);
	padding: 8px 12px;
	font-size: 14px;
	border-radius: var(--stw-radius);
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stw-header .stw-more-btn:hover {
	background: var(--stw-light-gray);
	border-color: var(--stw-primary);
	color: var(--stw-primary);
}

.stw-more-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	background: white;
	border: 1px solid var(--stw-border);
	border-radius: var(--stw-radius);
	box-shadow: var(--stw-shadow-lg);
	min-width: 220px;
	z-index: 1000;
	padding: 6px;
}

.stw-dropdown-item {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: transparent;
	border: none;
	color: var(--stw-dark);
	font-size: 14px;
	text-align: left;
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s;
}

.stw-dropdown-item:hover {
	background: rgba(16, 185, 129, 0.1);
	color: var(--stw-primary);
}

.stw-dropdown-item .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* ==========================================================================
   CONNECTION BAR
   ========================================================================== */

.stw-connection-bar {
	background: white;
	border: 1px solid var(--stw-border);
	border-radius: var(--stw-radius);
	padding: 16px 24px;
	margin: 20px 0;
	box-shadow: var(--stw-shadow);
}

.stw-connection-bar #connection-display {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	gap: 16px;
	flex-wrap: wrap;
}

/* ==========================================================================
   PLAN AND QUOTA DISPLAY
   ========================================================================== */

.stw-plan-quota-container {
	background: white;
	border: 1px solid var(--stw-border);
	border-radius: var(--stw-radius);
	padding: 20px 24px;
	margin: 20px 0;
	box-shadow: var(--stw-shadow);
}

/* Compact Dashboard Layout */
.stw-dashboard-info-compact {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 24px;
	flex-wrap: wrap;
}

.stw-user-plan-section {
	display: flex;
	align-items: center;
	gap: 24px;
	flex: 0 0 auto;
}

.stw-user-info-inline {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-right: 24px;
	border-right: 1px solid var(--stw-border);
}

.stw-user-info-inline .dashicons {
	font-size: 20px;
	color: var(--stw-gray);
}

.stw-username {
	font-weight: 600;
	font-size: 14px;
	color: var(--stw-dark);
	line-height: 1.3;
}

.stw-user-email {
	font-size: 11px;
	color: var(--stw-gray);
	line-height: 1.3;
}

.stw-plan-info-inline {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.stw-plan-info-inline .stw-plan-name {
	font-size: 16px;
	font-weight: 700;
	color: var(--stw-primary);
	line-height: 1.2;
}

.stw-plan-meta {
	font-size: 11px;
	color: var(--stw-gray);
	display: flex;
	align-items: center;
	gap: 6px;
	line-height: 1.2;
}

.stw-quota-section-compact {
	display: flex;
	align-items: center;
	gap: 20px;
	flex: 1;
	justify-content: flex-end;
	flex-wrap: wrap;
}

.stw-quota-item-compact {
	text-align: center;
	min-width: 100px;
}

.stw-quota-item-compact strong {
	display: block;
	margin-bottom: 4px;
	color: var(--stw-dark);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 600;
	line-height: 1.2;
}

.stw-quota-value-compact {
	font-size: 20px;
	font-weight: 700;
	margin: 2px 0;
	color: var(--stw-primary);
	line-height: 1.2;
	white-space: nowrap;
}

.stw-quota-sub-compact {
	font-size: 10px;
	color: var(--stw-gray);
	line-height: 1.2;
	white-space: nowrap;
}

/* Legacy Plan/Quota Styles */
.stw-plan-info-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 32px;
	flex-wrap: wrap;
}

.stw-plan-section {
	flex: 1;
	min-width: 200px;
}

.stw-plan-name {
	font-size: 20px;
	font-weight: 700;
	margin-bottom: 12px;
	color: var(--stw-primary);
}

.stw-plan-details {
	color: var(--stw-gray);
	font-size: 14px;
	line-height: 1.6;
}

.stw-plan-details div {
	margin: 4px 0;
}

.stw-quota-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 20px;
	flex: 2;
}

.stw-quota-item strong {
	display: block;
	margin-bottom: 8px;
	color: var(--stw-dark);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.stw-quota-value {
	font-size: 28px;
	font-weight: 700;
	margin: 6px 0;
	color: var(--stw-primary);
}

.stw-quota-sub {
	font-size: 12px;
	color: var(--stw-gray);
}

/* ==========================================================================
   PRODUCTS SECTION - Tabs and Actions
   ========================================================================== */

.stw-products-section {
	background: white;
	border: 1px solid var(--stw-border);
	border-radius: var(--stw-radius);
	padding: 24px;
	margin: 20px 0;
	box-shadow: var(--stw-shadow);
}

.stw-tabs-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	flex-wrap: wrap;
	gap: 16px;
}

.stw-tabs {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.stw-tab {
	background: var(--stw-light-gray);
	border: 1px solid var(--stw-border);
	padding: 10px 20px;
	cursor: pointer;
	border-radius: var(--stw-radius);
	transition: all 0.2s;
	font-size: 14px;
	font-weight: 500;
	color: var(--stw-gray);
}

.stw-tab:hover {
	background: rgba(16, 185, 129, 0.1);
	border-color: var(--stw-primary);
	color: var(--stw-primary);
}

.stw-tab.active {
	background: var(--stw-primary);
	border-color: var(--stw-primary);
	color: white;
	font-weight: 600;
}

.stw-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

/* Search and Filter */
.stw-search-sort {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	gap: 16px;
	flex-wrap: wrap;
}

.stw-search-sort input[type="text"] {
	flex: 1;
	min-width: 200px;
	max-width: 400px;
}

.stw-filter-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.stw-filter-actions .button {
	display: flex;
	align-items: center;
	gap: 6px;
}

.stw-filter-panel {
	background: var(--stw-light-gray);
	border: 1px solid var(--stw-border);
	border-radius: var(--stw-radius);
	padding: 16px;
	margin-bottom: 16px;
}

.stw-filter-content {
	display: flex;
	gap: 16px;
	align-items: center;
	flex-wrap: wrap;
}

.stw-filter-group {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	min-width: 200px;
}

.stw-filter-group label {
	font-weight: 500;
	white-space: nowrap;
	color: var(--stw-dark);
}

.stw-filter-group select {
	flex: 1;
}

.stw-sort-btn {
	background: var(--stw-light-gray);
	border: 1px solid var(--stw-border);
	padding: 8px 14px;
	cursor: pointer;
	border-radius: var(--stw-radius);
	transition: all 0.2s;
}

.stw-sort-btn:hover {
	background: rgba(16, 185, 129, 0.1);
	border-color: var(--stw-primary);
	color: var(--stw-primary);
}

/* ==========================================================================
   PRODUCTS TABLE
   ========================================================================== */

.stw-products-table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--stw-border);
	table-layout: fixed;
	border-radius: var(--stw-radius);
	overflow: hidden;
}

.stw-products-table thead {
	background: linear-gradient(to bottom, #f9fafb, var(--stw-light-gray));
}

.stw-products-table th {
	text-align: left;
	padding: 14px 16px;
	border-bottom: 2px solid var(--stw-border);
	font-weight: 600;
	color: var(--stw-dark);
	vertical-align: middle;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.stw-products-table td {
	padding: 14px 16px;
	border-bottom: 1px solid var(--stw-border);
	vertical-align: middle;
	word-wrap: break-word;
	overflow-wrap: break-word;
	background: white;
}

.stw-products-table tbody tr:hover td {
	background: rgba(16, 185, 129, 0.03);
}

.stw-product-cell {
	display: flex;
	align-items: center;
	gap: 12px;
}

.stw-product-icon {
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--stw-light-gray);
	border-radius: var(--stw-radius);
	font-size: 20px;
	flex-shrink: 0;
}

.stw-product-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--stw-radius);
}

.stw-product-id {
	font-size: 12px;
	color: var(--stw-gray);
	margin-top: 4px;
}

/* ==========================================================================
   LINKED 3D MODEL COLUMN
   ========================================================================== */

.stw-link-btn {
	background: transparent;
	border: none;
	color: var(--stw-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s;
	border-radius: var(--stw-radius);
}

.stw-link-btn:hover {
	background: rgba(16, 185, 129, 0.1);
	color: var(--stw-primary-dark);
}

.stw-link-btn .dashicons {
	font-size: 16px;
}

.stw-linked-model-content {
	display: flex;
	align-items: center;
	gap: 10px;
}

.stw-linked-item-info {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	min-width: 0;
}

.stw-linked-item-info > div {
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.stw-linked-item-info strong {
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.stw-linked-thumbnail {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 4px;
	background: #f0f0f0;
	flex-shrink: 0;
}

.stw-linked-icon {
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f0f0;
	border-radius: 4px;
	font-size: 20px;
	flex-shrink: 0;
}

.stw-unlinked-model {
	display: flex;
	align-items: center;
	gap: 10px;
}

.stw-unlinked-model p {
	flex: 1;
}

.stw-change-btn,
.stw-link-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	white-space: nowrap;
	vertical-align: middle;
}

.stw-change-btn .dashicons,
.stw-link-btn .dashicons {
	line-height: 1;
	vertical-align: middle;
}

/* ==========================================================================
   DASHBOARD RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 1200px) {
	.stw-header {
		gap: 10px;
	}

	.stw-header .stw-search-input {
		min-width: 200px;
	}
}

@media (max-width: 992px) {
	.stw-header {
		flex-wrap: wrap;
	}

	.stw-header .stw-search-input {
		flex: 1 1 100%;
		min-width: 100%;
		order: 1;
	}

	.stw-header .stw-sort-name-btn,
	.stw-header .stw-filter-btn,
	.stw-header .stw-more-menu {
		order: 0;
	}

	.stw-plan-info-row {
		flex-direction: column;
	}

	.stw-quota-grid {
		grid-template-columns: 1fr;
	}

	.stw-products-table {
		font-size: 14px;
	}

	.stw-products-table th,
	.stw-products-table td {
		padding: 10px;
	}

	.stw-dashboard-info-compact {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}

	.stw-user-plan-section {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		width: 100%;
	}

	.stw-user-info-inline {
		border-right: none;
		border-bottom: 1px solid var(--stw-border);
		padding-right: 0;
		padding-bottom: 12px;
		width: 100%;
	}

	.stw-quota-section-compact {
		justify-content: flex-start;
		gap: 16px;
		width: 100%;
	}
}

@media (max-width: 782px) {
	.stw-header {
		padding: 12px 0;
	}

	.stw-header .stw-sort-name-btn,
	.stw-header .stw-filter-btn,
	.stw-header .stw-more-btn {
		flex: 1;
	}

	.stw-tabs-actions,
	.stw-search-sort {
		flex-direction: column;
		align-items: flex-start;
	}

	.stw-actions,
	.stw-filter-actions {
		width: 100%;
	}

	.stw-actions .button {
		flex: 1;
		justify-content: center;
	}

	.stw-search-sort input[type="text"] {
		max-width: 100%;
	}

	.stw-products-table {
		display: block;
		overflow-x: auto;
	}

	.stw-product-cell {
		flex-direction: column;
		text-align: center;
	}

	.stw-linked-model-content {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.stw-unlinked-model {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.stw-unlinked-model p {
		text-align: center;
	}

	.stw-linked-item-info {
		width: 100%;
	}

	.stw-change-btn,
	.stw-link-btn {
		width: 100%;
		justify-content: center;
	}

	.stw-quota-grid {
		gap: 15px;
	}

	.stw-connection-bar #connection-display {
		flex-direction: column;
		align-items: flex-start;
	}

	.stw-quota-section-compact {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}

	.stw-quota-item-compact {
		min-width: auto;
	}
}

@media (max-width: 480px) {
	.stw-plan-quota-container,
	.stw-products-section {
		padding: 15px;
	}

	.stw-quota-value {
		font-size: 20px;
	}

	.stw-plan-name {
		font-size: 18px;
	}
}
