/**
 * DineSync Admin Styles
 *
 * @package DineSync_For_Clover
 */

/* Layout */
.dinesync-wrap {
	max-width: 960px;
}

.dinesync-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 16px 0;
	font-size: 23px;
	font-weight: 400;
}

.dinesync-header .dashicons {
	font-size: 28px;
	width: 28px;
	height: 28px;
	color: #2271b1;
}

.dinesync-version {
	font-size: 12px;
	color: #999;
	background: #f0f0f1;
	padding: 2px 8px;
	border-radius: 10px;
	margin-left: 4px;
}

/* Banner */
.dinesync-banner {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 20px 24px;
	border-radius: 8px;
	margin-bottom: 24px;
	border-left: 4px solid;
}

.dinesync-banner-success {
	background: #f0f9f0;
	border-color: #00a32a;
}

.dinesync-banner-warning {
	background: #fff8e5;
	border-color: #dba617;
}

.dinesync-banner-icon {
	font-size: 32px;
	line-height: 1;
}

.dinesync-banner-content h2 {
	margin: 0 0 4px;
	font-size: 18px;
}

.dinesync-banner-content p {
	margin: 0 0 12px;
	color: #50575e;
}

/* Cards */
.dinesync-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 24px;
	margin-bottom: 24px;
}

.dinesync-card h2 {
	margin-top: 0;
	padding-bottom: 12px;
	border-bottom: 1px solid #eee;
}

/* Stats */
.dinesync-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.dinesync-stat-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 20px;
	text-align: center;
}

.dinesync-stat-number {
	font-size: 28px;
	font-weight: 600;
	color: #1d2327;
	margin-bottom: 4px;
}

.dinesync-stat-label {
	font-size: 13px;
	color: #646970;
}

/* Action Buttons */
.dinesync-actions {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 24px;
	margin-bottom: 24px;
}

.dinesync-actions h2 {
	margin-top: 0;
}

.dinesync-action-buttons {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.dinesync-action-buttons .button-hero {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.dinesync-action-buttons .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	line-height: 1;
}

/* Result Messages */
.dinesync-result {
	padding: 12px 16px;
	border-radius: 4px;
	margin-top: 12px;
	font-size: 13px;
}

.dinesync-result.success {
	background: #f0f9f0;
	border: 1px solid #00a32a;
	color: #005c12;
}

.dinesync-result.error {
	background: #fcf0f1;
	border: 1px solid #d63638;
	color: #8a1114;
}

/* Logs Table */
.dinesync-logs-table {
	border-collapse: collapse;
}

.dinesync-logs-table th {
	text-align: left;
}

.dinesync-logs-table td,
.dinesync-logs-table th {
	padding: 10px 12px;
}

.dinesync-recent-logs {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 24px;
	margin-bottom: 24px;
}

.dinesync-recent-logs h2 {
	margin-top: 0;
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Badges */
.dinesync-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.dinesync-level-info {
	background: #e7f5ff;
	color: #0967d2;
}

.dinesync-level-success {
	background: #e6f9e6;
	color: #006b00;
}

.dinesync-level-warning {
	background: #fff8e5;
	color: #9d5d00;
}

.dinesync-level-error {
	background: #fce8e8;
	color: #cc1818;
}

/* Log Controls */
.dinesync-log-controls {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
	align-items: center;
}

.dinesync-log-controls .dashicons {
	vertical-align: middle;
	margin-top: -2px;
}

/* Toggle password */
.dinesync-toggle-password {
	vertical-align: middle;
	padding: 4px 8px !important;
}

.dinesync-toggle-password .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* =====================================================
   OAuth Connect Card
   ===================================================== */
.dinesync-card-oauth {
	border: 2px solid #00a32a;
	text-align: center;
	padding: 40px 24px;
}

.dinesync-oauth-content {
	max-width: 480px;
	margin: 0 auto;
}

.dinesync-oauth-icon {
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: #00a32a;
	margin-bottom: 8px;
}

.dinesync-card-oauth h2 {
	border-bottom: none;
	padding-bottom: 0;
	font-size: 22px;
}

.dinesync-card-oauth p {
	color: #50575e;
	font-size: 14px;
	margin-bottom: 24px;
}

.dinesync-btn-oauth {
	display: inline-block;
	background: #00a32a !important;
	color: #fff !important;
	border-color: #00a32a !important;
	font-size: 16px !important;
	padding: 12px 32px !important;
	height: auto !important;
	line-height: 1.4 !important;
	border-radius: 4px;
	text-decoration: none;
	font-weight: 600;
}

.dinesync-btn-oauth:hover,
.dinesync-btn-oauth:focus {
	background: #008a20 !important;
	border-color: #008a20 !important;
	color: #fff !important;
}

/* =====================================================
   Advanced / Manual Connection Card
   ===================================================== */
.dinesync-card-advanced {
	border-color: #dcdcde;
	background: #f9f9f9;
}

.dinesync-advanced-toggle {
	cursor: pointer;
	user-select: none;
}

.dinesync-advanced-toggle h2 {
	display: flex;
	align-items: center;
	gap: 6px;
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 4px;
	font-size: 15px;
	color: #50575e;
}

.dinesync-toggle-icon {
	font-size: 20px;
	width: 20px;
	height: 20px;
	transition: transform 0.2s ease;
	color: #50575e;
}

.dinesync-toggle-icon.dinesync-open {
	transform: rotate(90deg);
}

.dinesync-advanced-toggle .description {
	margin: 0;
	font-size: 13px;
}

.dinesync-advanced-body {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid #dcdcde;
	background: #fff;
	margin: 16px -24px -24px;
	padding: 16px 24px 24px;
	border-radius: 0 0 4px 4px;
}

/* =====================================================
   Connected Status Card
   ===================================================== */
.dinesync-card-connected {
	border-left: 4px solid #00a32a;
}

.dinesync-connected-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.dinesync-connected-header h2 {
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 0;
}

.dinesync-connected-icon {
	font-size: 32px;
	width: 32px;
	height: 32px;
	color: #00a32a;
}

.dinesync-connected-details {
	margin-bottom: 20px;
}

.dinesync-detail-row {
	display: flex;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f1;
}

.dinesync-detail-row:last-child {
	border-bottom: none;
}

.dinesync-detail-label {
	min-width: 160px;
	font-size: 13px;
	color: #646970;
}

.dinesync-detail-value {
	font-size: 13px;
	color: #1d2327;
}

.dinesync-badge-oauth {
	background: #e6f9e6;
	color: #006b00;
}

.dinesync-badge-manual {
	background: #e7f5ff;
	color: #0967d2;
}

.dinesync-connected-actions {
	padding-top: 16px;
	border-top: 1px solid #f0f0f1;
}

.dinesync-btn-disconnect {
	color: #d63638 !important;
	border-color: #d63638 !important;
}

.dinesync-btn-disconnect:hover,
.dinesync-btn-disconnect:focus {
	background: #d63638 !important;
	color: #fff !important;
}

/* =====================================================
   Legacy connected info (dashboard page)
   ===================================================== */
.dinesync-connected-info p {
	display: flex;
	align-items: center;
	gap: 6px;
}

.dinesync-connected-info .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* =====================================================
   Status Dot
   ===================================================== */
.dinesync-status-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #00a32a;
	margin-right: 6px;
	vertical-align: middle;
}

/* =====================================================
   Card Header Flex (title + action buttons)
   ===================================================== */
.dinesync-card-header-flex {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.dinesync-card-actions {
	display: inline-flex;
	gap: 6px;
	font-size: 13px;
	font-weight: 400;
}

/* =====================================================
   Section Divider
   ===================================================== */
.dinesync-section-divider {
	margin: 24px 0 16px;
	padding-top: 20px;
	border-top: 1px solid #eee;
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
}

/* =====================================================
   Field Toggles Grid
   ===================================================== */
.dinesync-field-toggles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 8px 16px;
	margin-top: 8px;
}

.dinesync-field-toggles label {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	transition: border-color 0.15s, background-color 0.15s;
}

.dinesync-field-toggles label:hover {
	border-color: #2271b1;
	background: #f0f6fc;
}

.dinesync-field-toggles input:checked + span {
	font-weight: 500;
}

/* =====================================================
   Compact Logs Table (settings page)
   ===================================================== */
.dinesync-logs-compact td,
.dinesync-logs-compact th {
	padding: 6px 10px;
	font-size: 12px;
}

.dinesync-logs-compact .dinesync-badge {
	font-size: 10px;
	padding: 1px 6px;
}

/* Responsive */
@media screen and (max-width: 782px) {
	.dinesync-stats {
		grid-template-columns: repeat(2, 1fr);
	}

	.dinesync-action-buttons {
		flex-direction: column;
	}

	.dinesync-action-buttons .button-hero {
		width: 100%;
		justify-content: center;
	}

	.dinesync-field-toggles {
		grid-template-columns: repeat(2, 1fr);
	}

	.dinesync-card-header-flex {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}
}

/* Loading spinner */
.dinesync-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #ccc;
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: dinesync-spin 0.6s linear infinite;
	vertical-align: middle;
	margin-right: 6px;
}

@keyframes dinesync-spin {
	to { transform: rotate(360deg); }
}
