/**
 * FFOA Financial Calculator Suite - Public Styles
 *
 * Comprehensive, mobile-responsive styles for all calculators.
 *
 * @package FFOA_Calculators
 * @version 1.0.0
 */

/* ==================================================================
   VARIABLES & FOUNDATIONS
   ================================================================== */

:root {
	--ffoa-primary-color: #222E51;
	--ffoa-primary-dark: #1a2340;
	--ffoa-secondary-color: #C2B97F;
	--ffoa-danger-color: #ef4444;
	--ffoa-warning-color: #f59e0b;
	--ffoa-success-color: #10b981;
	--ffoa-text-color: #1f2937;
	--ffoa-text-light: #6b7280;
	--ffoa-border-color: #d1d5db;
	--ffoa-bg-light: #f9fafb;
	--ffoa-bg-white: #ffffff;
	--ffoa-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--ffoa-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
	--ffoa-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
	--ffoa-radius: 8px;
	--ffoa-radius-lg: 12px;
	--ffoa-transition: all 0.3s ease;
}

/* ==================================================================
   CALCULATOR WRAPPER & LAYOUT - Enhanced from Installment Calculator
   ================================================================== */

.ffoa-calculator-wrapper,
.ffoa-all-calculators {
	max-width: 900px;
	margin: 2rem auto;
	padding: 0 1rem;
}

.ffoa-calculator {
	background: var(--ffoa-bg-white);
	border-radius: var(--ffoa-radius-lg);
	box-shadow: var(--ffoa-shadow-lg);
	padding: 2.5rem;
	margin-bottom: 2rem;
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

@media (max-width: 768px) {
	.ffoa-calculator {
		padding: 1.5rem;
	}
}

/* ==================================================================
   CALCULATOR HEADER
   ================================================================== */

.ffoa-calc-header {
	text-align: center;
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 2px solid var(--ffoa-border-color);
}

.ffoa-calc-header h2 {
	color: var(--ffoa-primary-color);
	font-size: 2rem;
	font-weight: 700;
	margin: 0 0 0.5rem 0;
}

.ffoa-calc-description {
	color: var(--ffoa-text-light);
	font-size: 1rem;
	line-height: 1.6;
	max-width: 600px;
	margin: 0 auto;
}

/* ==================================================================
   FORM SECTIONS & LAYOUT
   ================================================================== */

.ffoa-calc-section {
	background: var(--ffoa-bg-light);
	border-radius: var(--ffoa-radius);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}

.ffoa-calc-section-title {
	color: var(--ffoa-text-color);
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0 0 1rem 0;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--ffoa-primary-color);
}

.ffoa-form-row {
	margin-bottom: 1.25rem;
}

.ffoa-form-row:last-child {
	margin-bottom: 0;
}

.ffoa-form-row label {
	display: block;
	font-weight: 600;
	color: #333;
	margin-bottom: 0.5rem;
	font-size: 0.95rem;
}

.ffoa-field-required {
	color: var(--ffoa-danger-color);
	font-weight: 600;
	margin-left: 0.25rem;
}

/* ==================================================================
   FORM INPUTS - Enhanced Installment Calculator Styling
   ================================================================== */

.ffoa-form-row input[type="number"],
.ffoa-form-row input[type="text"],
.ffoa-form-row select,
.ffoa-currency-input {
	width: 100%;
	padding: 0.875rem;
	border: 2px solid #ddd;
	border-radius: 8px;
	font-size: 1rem;
	transition: all 0.3s ease;
	background: white;
	box-sizing: border-box;
}

.ffoa-form-row input[type="number"]:focus,
.ffoa-form-row input[type="text"]:focus,
.ffoa-form-row select:focus,
.ffoa-currency-input:focus {
	outline: none;
	border-color: var(--ffoa-primary-color);
	box-shadow: 0 0 0 3px rgba(34, 46, 81, 0.1);
}

.ffoa-form-row input::placeholder {
	color: #999;
}

/* ==================================================================
   BUTTONS - Matching Site-Wide Button Styling
   ================================================================== */

.ffoa-calc-btn,
.ffoa-calc-btn-primary {
	background: #222E51;
	color: white;
	padding: 1rem 2rem;
	border: none;
	border-radius: 8px;
	font-size: 1.1rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	width: 100%;
	margin-top: 1.5rem;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ffoa-calc-btn:hover,
.ffoa-calc-btn-primary:hover {
	background: #C2B97F;
	color: #222E51;
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
	transform: translateY(-2px);
}

.ffoa-calc-btn:active,
.ffoa-calc-btn-primary:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ffoa-calc-btn-secondary {
	background: white;
	color: var(--ffoa-primary-color);
	border: 2px solid var(--ffoa-primary-color);
	padding: 0.75rem 1.5rem;
	border-radius: var(--ffoa-radius);
	font-weight: 600;
	cursor: pointer;
	transition: var(--ffoa-transition);
	margin-top: 1rem;
	width: 100%;
}

.ffoa-calc-btn-secondary:hover {
	background: var(--ffoa-secondary-color);
	color: var(--ffoa-primary-color);
	border-color: var(--ffoa-secondary-color);
}

/* ==================================================================
   RESULTS SECTION - FFoA Brand Colors
   ================================================================== */

.ffoa-calc-results {
	margin-top: 2rem;
	padding: 2rem;
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-radius: 12px;
	border-left: 5px solid var(--ffoa-primary-color);
}

.ffoa-results-title {
	color: var(--ffoa-primary-color);
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0 0 1.5rem 0;
	text-align: center;
}

.ffoa-result-item {
	background: white;
	padding: 1.25rem;
	margin-bottom: 1rem;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: all 0.3s ease;
}

.ffoa-result-item:hover {
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.ffoa-result-item:last-child {
	margin-bottom: 0;
}

.ffoa-result-label {
	color: #666;
	font-weight: 600;
	font-size: 0.95rem;
}

.ffoa-result-value {
	color: var(--ffoa-primary-color);
	font-weight: 700;
	font-size: 1.5rem;
}

.ffoa-result-value.highlight {
	color: var(--ffoa-secondary-color);
	font-size: 1.75rem;
}

/* ==================================================================
   ALERTS & MESSAGES
   ================================================================== */

.ffoa-alert {
	padding: 1rem 1.25rem;
	border-radius: var(--ffoa-radius);
	margin-bottom: 1.5rem;
	border-left: 4px solid;
	font-size: 0.95rem;
	line-height: 1.6;
}

.ffoa-alert-info {
	background: #e8eaf0;
	border-color: var(--ffoa-primary-color);
	color: var(--ffoa-primary-dark);
}

.ffoa-alert-success {
	background: #d1fae5;
	border-color: var(--ffoa-success-color);
	color: #047857;
}

.ffoa-alert-warning {
	background: #fef3c7;
	border-color: var(--ffoa-warning-color);
	color: #92400e;
}

.ffoa-alert-danger {
	background: #fee2e2;
	border-color: var(--ffoa-danger-color);
	color: #991b1b;
}

/* ==================================================================
   EDUCATIONAL TIPS
   ================================================================== */

.ffoa-tip-box {
	background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
	border-left: 5px solid var(--ffoa-warning-color);
	padding: 1.5rem;
	border-radius: var(--ffoa-radius);
	margin-top: 2rem;
}

.ffoa-tip-title {
	color: #92400e;
	font-weight: 700;
	font-size: 1.1rem;
	margin: 0 0 0.75rem 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.ffoa-tip-title::before {
	content: "💡";
	font-size: 1.5rem;
}

.ffoa-tip-content {
	color: #78350f;
	line-height: 1.6;
	margin: 0;
}

/* ==================================================================
   CHARTS & VISUALIZATIONS
   ================================================================== */

.ffoa-chart-container {
	margin: 2rem 0;
	padding: 1.5rem;
	background: white;
	border-radius: var(--ffoa-radius);
	box-shadow: var(--ffoa-shadow-md);
}

.ffoa-chart-title {
	color: var(--ffoa-text-color);
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0 0 1.5rem 0;
	text-align: center;
}

canvas {
	max-height: 400px;
}

/* ==================================================================
   SUMMARY BOXES
   ================================================================== */

.ffoa-summary-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1.5rem;
	margin: 1.5rem 0;
}

.ffoa-summary-box {
	background: white;
	padding: 1.5rem;
	border-radius: var(--ffoa-radius);
	box-shadow: var(--ffoa-shadow-md);
	text-align: center;
	border-top: 4px solid var(--ffoa-primary-color);
}

.ffoa-summary-label {
	color: var(--ffoa-text-light);
	font-size: 0.875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 0.5rem;
}

.ffoa-summary-value {
	color: var(--ffoa-primary-color);
	font-size: 2rem;
	font-weight: 700;
	margin: 0;
}

.ffoa-summary-box.positive .ffoa-summary-value {
	color: var(--ffoa-success-color);
}

.ffoa-summary-box.negative .ffoa-summary-value {
	color: var(--ffoa-danger-color);
}

/* ==================================================================
   PROGRESS BARS
   ================================================================== */

.ffoa-progress-container {
	margin: 1.5rem 0;
}

.ffoa-progress-label {
	display: flex;
	justify-content: space-between;
	margin-bottom: 0.5rem;
	font-weight: 600;
	color: var(--ffoa-text-color);
}

.ffoa-progress-bar {
	width: 100%;
	height: 24px;
	background: #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
	position: relative;
}

.ffoa-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--ffoa-primary-color) 0%, var(--ffoa-secondary-color) 100%);
	border-radius: 12px;
	transition: width 0.6s ease;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding-right: 0.5rem;
	color: white;
	font-size: 0.75rem;
	font-weight: 600;
}

/* ==================================================================
   LOADING & DISABLED STATES
   ================================================================== */

.ffoa-loading {
	opacity: 0.6;
	pointer-events: none;
}

.ffoa-calc-btn:disabled,
.ffoa-calc-btn-primary:disabled {
	background: #9ca3af;
	cursor: not-allowed;
	transform: none;
}

.ffoa-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: white;
	animation: spin 1s ease-in-out infinite;
}

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

/* ==================================================================
   RESPONSIVE DESIGN
   ================================================================== */

@media (max-width: 768px) {
	.ffoa-calculator {
		padding: 1.5rem;
	}

	.ffoa-calc-header h2 {
		font-size: 1.5rem;
	}

	.ffoa-summary-grid {
		grid-template-columns: 1fr;
	}

	.ffoa-result-value {
		font-size: 1.25rem;
	}

	.ffoa-calc-btn,
	.ffoa-calc-btn-primary {
		font-size: 1rem;
		padding: 0.875rem 1.5rem;
	}
}

@media (max-width: 480px) {
	.ffoa-calculator {
		padding: 1rem;
	}

	.ffoa-calc-header {
		margin-bottom: 1.5rem;
		padding-bottom: 1rem;
	}

	.ffoa-calc-section {
		padding: 1rem;
	}

	.ffoa-form-row input[type="number"],
	.ffoa-form-row input[type="text"],
	.ffoa-form-row select {
		font-size: 16px; /* Prevents zoom on iOS */
	}
}

/* ==================================================================
   ACCESSIBILITY
   ================================================================== */

.ffoa-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

/* Focus styles for keyboard navigation */
.ffoa-form-row input:focus,
.ffoa-form-row select:focus,
.ffoa-calc-btn:focus,
.ffoa-calc-btn-primary:focus,
.ffoa-calc-btn-secondary:focus {
	outline: 3px solid var(--ffoa-secondary-color);
	outline-offset: 2px;
}

/* Ensure sufficient color contrast */
@media (prefers-contrast: high) {
	.ffoa-form-row input,
	.ffoa-form-row select {
		border-width: 3px;
	}

	.ffoa-calc-btn,
	.ffoa-calc-btn-primary {
		font-weight: 700;
	}
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ==================================================================
   PRINT STYLES
   ================================================================== */

@media print {
	.ffoa-calc-btn,
	.ffoa-calc-btn-primary,
	.ffoa-calc-btn-secondary {
		display: none;
	}

	.ffoa-calculator {
		box-shadow: none;
		border: 1px solid #000;
	}

	.ffoa-calc-results {
		page-break-inside: avoid;
	}
}
