/*
 * WooCommerce Loyalty Rewards - Frontend Dashboard Styles
 */

.loyalty-rewards-dashboard {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #333;
}

/* --------------------------------------------------------------------------
 * Clean UI Improvements - Cart & Checkout Reward Preview
 * -------------------------------------------------------------------------- */
.wc-loyalty-progress-container {
	background: #f6fdf7;
	border-left: 4px solid #2ecc71;
	padding: 14px 16px;
	border-radius: 6px;
	margin-top: 12px;
	margin-bottom: 20px;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
	color: #2c3e50;
	transition: all 0.3s ease;
}

.wc-loyalty-progress-container strong {
	color: #27ae60;
	margin: 0 4px;
	font-weight: 600;
}

.wc-loyalty-progress-text {
	font-size: 13px;
	margin: 8px 0 4px 0;
	color: #555;
}

.wc-loyalty-progress-bar {
	height: 8px;
	background: #e8f5e9;
	border-radius: 10px;
	overflow: hidden;
	margin-top: 8px;
}

.wc-loyalty-progress-fill {
	height: 8px;
	background: #27ae60;
	transition: width .3s ease;
}

@media screen and (max-width: 768px) {
	.wc-loyalty-progress-container {
		padding: 10px 14px;
		font-size: 13px;
	}
}

/* Base Card Grid */
.lr-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
	margin-bottom: 25px;
}

.lr-card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 20px 15px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
	border-left-width: 5px;
}

.lr-card.border-blue { border-left-color: #3b82f6; }
.lr-card.border-green { border-left-color: #10b981; }
.lr-card.border-yellow { border-left-color: #f59e0b; }
.lr-card.border-red { border-left-color: #ef4444; }

.lr-card-title {
	font-size: 14px;
	color: #6b7280;
	margin-bottom: 10px;
	font-weight: 500;
}

.lr-card-metric {
	font-size: 28px;
	font-weight: 700;
	color: #111827;
}

/* Tier Progress */
.lr-progress-section {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 24px;
	margin-bottom: 25px;
}

.lr-progress-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	font-size: 15px;
	color: #4b5563;
	font-weight: 500;
}

.lr-progress-values {
	color: #2563eb;
	font-weight: 600;
}

.lr-progress-bar-wrap {
	background-color: #e5e7eb;
	border-radius: 999px;
	height: 12px;
	width: 100%;
	overflow: hidden;
	margin-bottom: 15px;
}

.lr-progress-bar-fill {
	background-color: #e5e7eb;
	/* fallback gradient */
	background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
	height: 100%;
	border-radius: 999px;
	transition: width 0.5s ease-in-out;
}

.lr-progress-footer {
	font-size: 14px;
	color: #6b7280;
}

/* Stats Section */
.lr-stats-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	margin-bottom: 25px;
}

.lr-stat-card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 20px;
	text-align: center;
}

.lr-stat-title {
	font-size: 14px;
	color: #6b7280;
	margin-bottom: 10px;
}

.lr-stat-value {
	font-size: 20px;
	font-weight: 600;
}

.lr-green-text { color: #10b981; }
.lr-red-text { color: #ef4444; }
.lr-blue-text { color: #3b82f6; }
.lr-yellow-text { color: #f59e0b; }
.lr-tier-text { font-size: 20px; color: #10b981; line-height: 1.2; }

/* Forms Sections */
.lr-section {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 24px;
	margin-bottom: 25px;
}

.lr-section-title {
	margin-top: 0;
	margin-bottom: 10px;
	font-size: 18px;
	color: #111827;
	border-bottom: 1px solid #f3f4f6;
	padding-bottom: 10px;
}

.lr-section-desc {
	color: #4b5563;
	font-size: 15px;
	margin-bottom: 20px;
}

.lr-form {
	max-width: 100%;
}

.lr-form-row {
	margin-bottom: 20px;
}

.lr-form-row label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
	color: #374151;
	font-size: 14px;
}

.lr-form-row label .required {
	color: #ef4444;
}

.lr-input {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 15px;
	max-width: 500px;
}

.lr-grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	max-width: 800px;
}

.lr-field-hint {
	font-size: 12px;
	color: #6b7280;
	margin-top: 6px;
}

.lr-form-actions .button {
	background-color: #1d4ed8;
	color: #fff;
	border: none;
	padding: 12px 24px;
	font-size: 15px;
	border-radius: 6px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s;
}

.lr-form-actions .button:hover {
	background-color: #1e40af;
}

/* History Table */
.lr-table {
	width: 100%;
	border-collapse: collapse;
}

.lr-table th {
	text-align: left;
	padding: 12px 15px;
	border-bottom: 2px solid #e2e8f0;
	color: #4b5563;
	font-weight: 600;
	font-size: 14px;
}

.lr-table td {
	padding: 15px;
	border-bottom: 1px solid #e2e8f0;
	color: #111827;
	font-size: 14px;
}

.lr-table tbody tr:last-child td {
	border-bottom: none;
}

.lr-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 9999px;
	font-size: 12px;
	font-weight: 500;
	text-transform: capitalize;
}

.badge-green { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-orange { background: #ffedd5; color: #c2410c; }

.lr-table tbody tr { transition: background-color 0.15s; }
.lr-table tbody tr:hover { background-color: #f9fafb; }

.lr-points-cell {
	font-weight: 600;
}

/* Responsive Rules */
@media (max-width: 1024px) {
	.lr-cards-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.lr-stats-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.lr-cards-grid {
		grid-template-columns: 1fr;
	}
	.lr-stats-grid {
		grid-template-columns: 1fr;
	}
	.lr-grid-2 {
		grid-template-columns: 1fr;
	}
	.lr-form-row .lr-input {
		max-width: 100%;
	}
	.lr-form-actions .button {
		width: 100%;
	}
	
	/* Mobile Table override via woocommerce classes if necessary or custom stacked */
	.lr-table thead {
		display: none;
	}
	.lr-table tbody td {
		display: block;
		text-align: right;
		padding: 10px 15px;
	}
	.lr-table tbody td::before {
		content: attr(data-title);
		float: left;
		font-weight: 600;
		color: #4b5563;
	}
	.lr-table tbody tr {
		display: block;
		border-bottom: 1px solid #e2e8f0;
		padding: 10px 0;
	}
}

/* Checkout and Orders Loyalty Box */
.loyalty-reward-box {
	background-color: #fefce8;
	border: 1px dashed #eab308;
	padding: 12px 15px;
	border-radius: 6px;
	color: #854d0e;
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 2em;
}
.loyalty-points-preview .loyalty-reward-box {
	margin-bottom: 0;
}
.loyalty-reward-box.lr-thank-you {
	border-style: solid;
	padding: 20px;
	align-items: flex-start;
	gap: 12px;
}
.loyalty-reward-box .dashicons {
	color: #eab308;
}
.loyalty-reward-box .lr-icon-small {
	font-size: 20px;
	width: 20px;
	height: 20px;
}
.loyalty-reward-box .lr-icon-large {
	font-size: 24px;
	width: 24px;
	height: 24px;
	margin-top: 2px;
}
.loyalty-reward-box .lr-text {
	font-weight: 500;
	font-size: 14px;
}
.loyalty-reward-box .lr-title {
	margin: 0 0 8px;
	color: #854d0e;
	font-size: 18px;
}
.loyalty-reward-box .lr-desc {
	font-size: 15px;
}

/* Dashboard Fixes */
.lr-empty-dashboard {
	text-align: center;
	padding: 40px;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
	margin-bottom: 20px;
}
.lr-empty-dashboard p {
	font-size: 16px;
	color: #6b7280;
}
.lr-empty-dashboard .button {
	margin-top: 20px;
}
.lr-notice-message {
	background-color: #f3f4f6;
	color: #111827;
	border-color: #6b7280;
}
.lr-error-desc {
	color: #b91c1c;
	font-weight: 500;
}
.lr-table-strike {
	text-decoration: line-through;
	color: #9ca3af;
	margin-right: 5px;
}

/* New CSS from Refactor */
.lr-warning-banner {
    background: #fff8e5;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lr-warning-banner .dashicons {
    color: #f39c12;
}

.lr-warning-banner p {
    margin: 0;
    color: #856404;
}

.lr-gray-text {
    color: #6b7280;
}

.lr-section-footer {
    text-align: center;
    margin-top: 15px;
}

.lr-redeem-banner {
    background: #f0f7ff;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
    margin-bottom: 20px;
}

.lr-redeem-banner p {
    margin: 0;
    font-weight: 500;
}

.lr-align-right {
    text-align: right;
}

.lr-no-border {
    border-bottom: none;
    margin-bottom: 10px;
}

.lr-preview-cell {
    padding: 10px 0;
}

/* Tier Progression (Phase 5) */
.lr-tier-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.lr-tier-current .lr-label,
.lr-tier-next .lr-label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.lr-tier-current .lr-value {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-right: 8px;
}

.lr-tier-current .lr-multiplier {
    font-size: 14px;
    color: #10b981;
    font-weight: 600;
}

.lr-tier-next {
    text-align: right;
}

.lr-tier-next .lr-value {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
}

.lr-tier-highest .lr-success {
    color: #10b981;
    font-weight: 600;
    font-size: 16px;
}

.loyalty-progress {
    height: 12px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.loyalty-progress .bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lr-progress-footer {
    display: block;
    font-size: 14px;
    color: #475569;
}

.lr-progress-footer strong {
    color: #0f172a;
    font-weight: 700;
}

@media (max-width: 600px) {
    .lr-tier-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .lr-tier-next {
        text-align: left;
    }
}

/* --------------------------------------------------------------------------
 * Dynamic Value Preview (Premium Enhancements)
 * -------------------------------------------------------------------------- */
.lr-field-preview {
    display: none;
    margin-top: 15px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #475569;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.lr-field-preview strong {
    font-size: 18px;
    color: #0f172a;
    font-weight: 700;
}

.lr-field-preview .lr-preview-icon {
    background: #10b981;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

#lr-gift-value-preview {
    color: #10b981;
    transition: color 0.3s ease;
}

.lr-field-preview.has-value {
    display: inline-flex;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.lr-field-preview.has-value #lr-gift-value-preview {
    color: #15803d;
}

.lr-error-msg {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
    font-weight: 500;
}
