/**
 * Endoca Subscriptions My Account Styles
 */

.endoca-subscriptions-list {
	margin-top: 20px;
}

.endoca-subscriptions-list .woocommerce-orders-table {
	width: 100%;
	border-collapse: collapse;
}

.endoca-subscriptions-list .woocommerce-orders-table th,
.endoca-subscriptions-list .woocommerce-orders-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.endoca-subscriptions-list .woocommerce-orders-table th {
	font-weight: 600;
	background-color: #f5f5f5;
}

.endoca-subscriptions-list .woocommerce-orders-table tr:hover {
	background-color: #f9f9f9;
}

.woocommerce-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
}

.woocommerce-badge--active {
	background-color: #46b450;
	color: #fff;
}

.woocommerce-badge--in-progress {
	background-color: #2271b1;
	color: #fff;
}

.woocommerce-badge--inactive {
	background-color: #666;
	color: #fff;
}

.woocommerce-badge--pending {
	background-color: #f0b849;
	color: #fff;
}

@media (max-width: 768px) {
	.endoca-subscriptions-list .woocommerce-orders-table {
		display: block;
	}
	
	.endoca-subscriptions-list .woocommerce-orders-table thead {
		display: none;
	}
	
	.endoca-subscriptions-list .woocommerce-orders-table tbody,
	.endoca-subscriptions-list .woocommerce-orders-table tr,
	.endoca-subscriptions-list .woocommerce-orders-table td {
		display: block;
		width: 100%;
	}
	
	.endoca-subscriptions-list .woocommerce-orders-table tr {
		margin-bottom: 20px;
		border: 1px solid #e0e0e0;
		border-radius: 4px;
		padding: 10px;
	}
	
	.endoca-subscriptions-list .woocommerce-orders-table td {
		border: none;
		padding: 8px 0;
	}
	
	.endoca-subscriptions-list .woocommerce-orders-table td:before {
		content: attr(data-title) ": ";
		font-weight: 600;
		display: inline-block;
		width: 120px;
	}
}

/* Subscription Details Page */
.endoca-subscription-details {
	margin-top: 20px;
}

.endoca-subscription-details-content {
	margin-top: 20px;
}

.endoca-subscription-details-content h2 {
	margin-bottom: 20px;
}

.endoca-subscription-details-content .subscription_details_table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 20px;
}

.endoca-subscription-details-content .subscription_details_table th,
.endoca-subscription-details-content .subscription_details_table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.endoca-subscription-details-content .subscription_details_table th {
	font-weight: 600;
	width: 200px;
	background-color: #f5f5f5;
}

.endoca-subscription-details-content .subscription_details_table address {
	font-style: normal;
	margin: 0;
	line-height: 1.6;
}

@media (max-width: 768px) {
	.endoca-subscription-details-content .subscription_details_table th,
	.endoca-subscription-details-content .subscription_details_table td {
		display: block;
		width: 100%;
		padding: 8px 0;
	}
	
	.endoca-subscription-details-content .subscription_details_table th {
		background-color: transparent;
		font-weight: 700;
		margin-top: 10px;
	}
	
	.endoca-subscription-details-content .subscription_details_table th:first-child {
		margin-top: 0;
	}
}

/* Frequency Change Modal */
.endoca-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 100000;
}

.endoca-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
}

.endoca-modal-content {
	position: relative;
	background: #fff;
	max-width: 500px;
	margin: 50px auto;
	border-radius: 4px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	z-index: 100001;
}

.endoca-modal-header {
	padding: 20px;
	border-bottom: 1px solid #e0e0e0;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.endoca-modal-header h3 {
	margin: 0;
	font-size: 18px;
}

.endoca-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.endoca-modal-close:hover {
	color: #000;
}

.endoca-modal-close:disabled,
.endoca-modal-close[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.endoca-modal-body {
	padding: 20px;
}

.endoca-frequency-select {
	width: 100%;
	padding: 10px;
	margin: 10px 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
    min-height: 50px;
}

.endoca-modal-actions {
	padding: 20px!important;
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

.endoca-modal-actions .button {
	margin: 0;
}

/* Confirmation Modal Specific Styles */
#endoca-confirm-modal .endoca-modal-body p {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
}

#endoca-confirm-btn.button-primary {
	background-color: #d63638;
	border-color: #d63638;
	color: #fff;
}

#endoca-confirm-btn.button-primary:hover {
	background-color: #b32d2e;
	border-color: #b32d2e;
}

.endoca-frequency-display {
	position: relative;
}

.endoca-change-frequency-btn {
	margin-top: 10px;
}

@media (max-width: 768px) {
	.endoca-modal-content {
		margin: 20px;
		max-width: calc(100% - 40px);
	}
}

/* Subscription Products List */
.endoca-subscription-products-list {
	list-style: none;
	padding: 0;
	margin: 10px 0;
}

.endoca-subscription-product-item {
	padding: 15px 0;
	border-bottom: 1px solid #e0e0e0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 15px;
}

.endoca-subscription-product-item:last-child {
	border-bottom: none;
}

.endoca-product-name-wrapper {
	flex: 1;
}

.endoca-product-name-wrapper a {
	text-decoration: none;
	color: #333;
	font-weight: 500;
}

.endoca-product-name-wrapper a:hover {
	color: #2271b1;
}

.endoca-product-name-wrapper .quantity-badge {
	margin-left: 8px;
	color: #666;
	font-size: 0.9em;
	font-weight: normal;
}

/* Price Breakdown */
.endoca-payment-price {
	cursor: pointer;
	text-decoration: underline;
	color: #2271b1;
	transition: color 0.3s;
}

.endoca-payment-price:hover {
	color: #135e96;
}

.endoca-price-breakdown {
	margin-top: 15px;
	padding: 15px;
	background-color: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
}

.endoca-breakdown-table {
	width: 100%;
	border-collapse: collapse;
}

.endoca-breakdown-table th {
	text-align: left;
	padding: 10px 8px;
	font-weight: 600;
	color: #333;
	border-bottom: 2px solid #ddd;
}

.endoca-breakdown-table th:last-child,
.endoca-breakdown-table td:last-child {
	text-align: right;
}

.endoca-breakdown-table td {
	padding: 8px;
	border-bottom: 1px solid #eee;
}

.endoca-breakdown-table tbody tr:hover {
	background-color: #f5f5f5;
}

.endoca-breakdown-table tfoot tr {
	border-top: 2px solid #ddd;
}

.endoca-breakdown-table tfoot tr:last-child {
	border-top: 2px solid #333;
	font-size: 1.1em;
}

@media (max-width: 768px) {
	.endoca-breakdown-table {
		font-size: 0.9em;
	}
	
	.endoca-breakdown-table th,
	.endoca-breakdown-table td {
		padding: 6px 4px;
	}
}

.endoca-product-quantity-wrapper {
	display: flex;
	align-items: center;
}

.endoca-quantity-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #666;
	margin: 0;
}

.endoca-item-quantity {
	width: 60px;
	padding: 6px 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-align: center;
	font-size: 14px;
	transition: border-color 0.3s, box-shadow 0.3s;
}

.endoca-item-quantity:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.endoca-item-quantity.updating {
	opacity: 0.6;
	cursor: wait;
}

.endoca-item-quantity.updated {
	border-color: #00a32a;
	background-color: #f0f9ff;
}

.endoca-subscription-products-list .quantity {
	color: #666;
	font-size: 0.9em;
}

.endoca-product-actions {
	display: flex;
	align-items: center;
}

.endoca-remove-product-btn {
	font-size: 12px;
	padding: 5px 10px;
}

/* Add Product Page */
.endoca-add-subscription-product {
	margin-top: 20px;
}

.endoca-add-product-content h2 {
	margin-bottom: 20px;
}

.subscription-info {
	margin-bottom: 20px;
	padding: 10px;
	background-color: #f5f5f5;
	border-radius: 4px;
}

.endoca-product-search-wrapper {
	display: flex;
	gap: 10px;
	margin-bottom: 30px;
}

.endoca-product-search {
	flex: 1;
	padding: 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
}

.endoca-products-results {
	margin-top: 20px;
}

.endoca-products-results h3 {
	margin-bottom: 20px;
}

.endoca-products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 20px;
	margin-top: 20px;
}

.endoca-product-card {
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: 15px;
	text-align: center;
	transition: box-shadow 0.3s;
}

.endoca-product-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.endoca-product-image {
	margin-bottom: 10px;
}

.endoca-product-image img {
	max-width: 100%;
	height: auto;
}

.endoca-product-info h4 {
	margin: 10px 0 5px;
	font-size: 14px;
}

.endoca-product-info h4 a {
	text-decoration: none;
	color: #333;
}

.endoca-product-sku {
	font-size: 12px;
	color: #666;
	margin: 5px 0;
}

.endoca-product-price {
	font-weight: 600;
	margin: 10px 0;
	color: #2271b1;
}

.endoca-variable-note {
	font-size: 11px;
	color: #666;
	font-style: italic;
	margin: 5px 0;
}

.endoca-add-product-btn {
	width: 100%;
	margin-top: 10px;
}

.endoca-loading,
.endoca-error {
	padding: 20px;
	text-align: center;
}

.endoca-error {
	color: #d63638;
}

@media (max-width: 768px) {
	.endoca-products-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 15px;
	}
	
	.endoca-product-search-wrapper {
		flex-direction: column;
	}
}

/* Pending Orders Section */
.endoca-pending-orders-section {
	margin-top: 40px;
	padding-top: 20px;
	border-top: 2px solid #e0e0e0;
}

.endoca-pending-orders-section h3 {
	margin-bottom: 20px;
	font-size: 20px;
}

.endoca-pending-orders-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
}

.endoca-pending-orders-table th,
.endoca-pending-orders-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.endoca-pending-orders-table th {
	font-weight: 600;
	background-color: #f5f5f5;
}

.endoca-pending-orders-table tbody tr:hover {
	background-color: #f9f9f9;
}

@media (max-width: 768px) {
	.endoca-pending-orders-table {
		display: block;
	}
	
	.endoca-pending-orders-table thead {
		display: none;
	}
	
	.endoca-pending-orders-table tbody,
	.endoca-pending-orders-table tr,
	.endoca-pending-orders-table td {
		display: block;
		width: 100%;
	}
	
	.endoca-pending-orders-table tr {
		margin-bottom: 20px;
		border: 1px solid #e0e0e0;
		border-radius: 4px;
		padding: 10px;
	}
	
	.endoca-pending-orders-table td {
		border: none;
		padding: 8px 0;
	}
	
	.endoca-pending-orders-table td:before {
		content: attr(data-title) ": ";
		font-weight: 600;
		display: inline-block;
		width: 120px;
	}
}

/* Related Orders Section */
.endoca-related-orders-section {
	margin-top: 40px;
	padding-top: 20px;
	border-top: 2px solid #e0e0e0;
}

.endoca-related-orders-section h3 {
	margin-bottom: 20px;
	font-size: 20px;
}

.endoca-related-orders-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
}

.endoca-related-orders-table th,
.endoca-related-orders-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.endoca-related-orders-table th {
	font-weight: 600;
	background-color: #f5f5f5;
}

.endoca-related-orders-table tbody tr:hover {
	background-color: #f9f9f9;
}

.endoca-order-badge {
	font-size: 11px;
	color: #666;
	font-style: italic;
}

.endoca-related-orders-table .button-small {
	padding: 5px 10px;
	font-size: 12px;
	line-height: 1.5;
}

@media (max-width: 768px) {
	.endoca-related-orders-table {
		display: block;
	}
	
	.endoca-related-orders-table thead {
		display: none;
	}
	
	.endoca-related-orders-table tbody,
	.endoca-related-orders-table tr,
	.endoca-related-orders-table td {
		display: block;
		width: 100%;
	}
	
	.endoca-related-orders-table tr {
		margin-bottom: 20px;
		border: 1px solid #e0e0e0;
		border-radius: 4px;
		padding: 10px;
	}
	
	.endoca-related-orders-table td {
		border: none;
		padding: 8px 0;
	}
	
	.endoca-related-orders-table td:before {
		content: attr(data-title) ": ";
		font-weight: 600;
		display: inline-block;
		width: 120px;
	}
}

