/**
 * Magazine Access Manager - Frontend Stylesheet
 */

/* Container & Layout */
.mam-form-container,
.mam-access-denied-container {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	margin: 20px auto;
	max-width: 600px;
	box-sizing: border-box;
}

/* Card Styling for Access Denied screen */
.mam-access-denied-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 40px 30px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	text-align: center;
}

.mam-lock-icon {
	width: 60px;
	height: 60px;
	background: #fee2e2;
	color: #ef4444;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px auto;
}

.mam-lock-icon .dashicons {
	font-size: 30px;
	width: 30px;
	height: 30px;
}

.mam-denied-title {
	font-size: 22px;
	color: #1e293b;
	margin: 0 0 10px 0;
	font-weight: 700;
}

.mam-denied-description {
	font-size: 15px;
	color: #64748b;
	line-height: 1.6;
	margin: 0 0 30px 0;
}

.mam-denied-form-wrapper {
	border-top: 1px solid #e2e8f0;
	padding-top: 30px;
	text-align: left;
}

.mam-form-title {
	font-size: 16px;
	color: #334155;
	margin: 0 0 20px 0;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Form Groups & Inputs */
.mam-input-group {
	margin-bottom: 20px;
}

.mam-input-group label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #475569;
	margin-bottom: 8px;
}

.mam-required {
	color: #ef4444;
}

.mam-field {
	width: 100%;
	padding: 10px 14px;
	font-size: 15px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background-color: #f8fafc;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
	transition: all 0.2s ease-in-out;
	box-sizing: border-box;
}

.mam-field:focus {
	border-color: #3b82f6;
	background-color: #ffffff;
	outline: none;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

select.mam-field {
	height: 44px;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2364748b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 16px;
	padding-right: 40px;
}

/* Submit Button */
.mam-submit-button {
	width: 100%;
	padding: 12px 20px;
	background-color: #2563eb;
	color: #ffffff;
	border: none;
	border-radius: 6px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
	transition: all 0.2s ease-in-out;
}

.mam-submit-button:hover {
	background-color: #1d4ed8;
	box-shadow: 0 4px 6px rgba(29, 78, 216, 0.3);
	transform: translateY(-1px);
}

.mam-submit-button:active {
	transform: translateY(0);
}

/* Alert Notification Boxes */
.mam-alert {
	border-radius: 6px;
	padding: 14px 18px;
	margin-bottom: 25px;
	font-size: 14px;
	line-height: 1.5;
}

.mam-alert p {
	margin: 0;
}

.mam-alert-success {
	background-color: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.mam-alert-danger {
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.mam-alert-info {
	background-color: #eff6ff;
	border: 1px solid #dbeafe;
	color: #1e40af;
}

/* Empty State */
.mam-no-magazines {
	text-align: center;
	color: #64748b;
	font-style: italic;
	padding: 20px;
}

/* ==========================================================================
   Access Modal Box
   ========================================================================== */
.mam-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 99999;
	display: none; /* Hidden by default */
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.mam-modal.mam-active {
	display: flex; /* Show as flex when active */
}

.mam-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(4px);
}

.mam-modal-content {
	position: relative;
	background: #ffffff;
	border-radius: 12px;
	width: 100%;
	max-width: 500px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
	animation: mamModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 100000;
	padding: 30px;
	box-sizing: border-box;
}

.mam-modal-close {
	position: absolute;
	top: 15px;
	right: 15px;
	background: none;
	border: none;
	font-size: 28px;
	color: #94a3b8;
	cursor: pointer;
	line-height: 1;
	padding: 0;
	transition: color 0.15s ease-in-out;
}

.mam-modal-close:hover {
	color: #334155;
}

.mam-modal-header {
	margin-bottom: 25px;
	border-bottom: 1px solid #f1f5f9;
	padding-bottom: 15px;
	text-align: left;
}

.mam-modal-title {
	font-size: 20px;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 6px 0;
}

.mam-modal-subtitle {
	font-size: 13px;
	color: #64748b;
	margin: 0;
	line-height: 1.5;
}

.mam-modal-body .mam-form-container {
	margin: 0;
	max-width: 100%;
}

@keyframes mamModalFadeIn {
	from {
		opacity: 0;
		transform: scale(0.95) translateY(10px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

/* ==========================================================================
   Magazines Grid Shortcode Styling [mam_magazine_grid]
   ========================================================================== */
.mam-grid-container {
	margin: 30px auto;
	width: 100%;
	max-width: 1200px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	box-sizing: border-box;
}

.mam-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 25px;
	margin-top: 20px;
}

.mam-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
	transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
	display: flex;
	flex-direction: column;
	position: relative;
}

.mam-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
}

.mam-card-image-wrap {
	position: relative;
	width: 100%;
	padding-top: 130%; /* 1.3:1 Portrait aspect ratio, standard for magazine covers */
	background: #f1f5f9;
	overflow: hidden;
}

.mam-card-image-link {
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
}

.mam-card-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.mam-card:hover .mam-card-image {
	transform: scale(1.05);
}

.mam-card-image-placeholder {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
	color: #ffffff;
	font-weight: 700;
	letter-spacing: 2px;
	font-size: 1.2em;
}

.mam-card-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	padding: 5px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	z-index: 2;
}

.mam-badge-unlocked {
	background: #10b981;
	color: #ffffff;
}

.mam-badge-locked {
	background: #f59e0b;
	color: #ffffff;
}

.mam-card-content {
	padding: 20px;
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

.mam-card-title {
	font-size: 18px;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 10px 0;
	line-height: 1.4;
}

.mam-card-desc {
	font-size: 14px;
	color: #64748b;
	line-height: 1.6;
	margin: 0 0 20px 0;
	flex-grow: 1;
}

.mam-card-action {
	margin-top: auto;
}

.mam-card-btn {
	display: block;
	width: 100%;
	padding: 10px 15px;
	text-align: center;
	text-decoration: none !important;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.2s ease-in-out;
	box-sizing: border-box;
}

.mam-btn-read {
	background: #10b981;
	color: #ffffff !important;
	box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.mam-btn-read:hover {
	background: #059669;
	box-shadow: 0 4px 6px rgba(5, 150, 105, 0.3);
}

.mam-btn-unlock {
	background: #3b82f6;
	color: #ffffff !important;
	box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.mam-btn-unlock:hover {
	background: #2563eb;
	box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

.mam-card-no-link {
	display: block;
	width: 100%;
	padding: 10px 15px;
	text-align: center;
	background: #f1f5f9;
	color: #94a3b8;
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	cursor: default;
}

/* Responsive Iframe Container */
.mam-iframe-container {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 135%; /* Portrait aspect ratio matching standard paper size */
	overflow: hidden;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	background: #f8fafc;
	margin: 20px 0;
}

.mam-iframe-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
