/**
 * Photos Page Styles
 *
 * Styles for the photos page template (page-photos.php).
 * Extracted and adapted from the static photos.html design reference.
 *
 * Depends on main.css for: --primary, --dark, --text-light, --text-dark, --light-bg,
 * --shadow-md, --radius, --transition, --secondary, --success.
 *
 * @package ecole-du-bonheur
 */

/* ================================================================
   PAGE TITLE QUOTES — photos blue override
   ================================================================ */

.page-title-quotes::before,
.page-title-quotes::after {
	color: #7CB8E8;
}

/* ================================================================
   LAYOUT
   ================================================================ */

.photos-content {
	max-width: 1400px;
	margin: 0 auto;
}

/* ================================================================
   ACCESS SECTION
   ================================================================ */

.access-section {
	background: white;
	border-radius: var(--radius);
	padding: 2rem;
	box-shadow: var(--shadow-md);
	margin-bottom: 2rem;
}

.access-header {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 2px solid var(--light-bg);
}

/* Access icon — included for future use (staff access section) */
.access-icon {
	width: 70px;
	height: 70px;
	border-radius: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 2rem;
	flex-shrink: 0;
}

.access-icon.parents {
	background: linear-gradient(135deg, #4169E1 0%, #6B8DE8 100%);
}

.access-icon.staff {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.access-header h2 {
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--dark);
	margin-bottom: 0.25rem;
}

.access-header p {
	color: var(--text-light);
	font-size: 0.95rem;
}

/* ================================================================
   CODE FORM
   ================================================================ */

.code-form {
	display: flex;
	gap: 1rem;
	align-items: flex-end;
	flex-wrap: wrap;
	margin-bottom: 2rem;
}

.code-form .form-group {
	flex: 1;
	min-width: 250px;
}

.code-form label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
	color: var(--text-dark);
	margin-bottom: 0.5rem;
}

.code-form label i {
	color: var(--primary);
}

.code-form input {
	width: 100%;
	padding: 0.875rem 1rem;
	border: 2px solid #E5E7EB;
	border-radius: 10px;
	font-size: 1rem;
	transition: var(--transition);
}

.code-form input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
}

/* ================================================================
   CLASSES INFO
   ================================================================ */

.classes-info {
	background: var(--light-bg);
	border-radius: 16px;
	padding: 1.5rem;
}

.classes-info h3 {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--dark);
	margin-bottom: 1.25rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.classes-info h3 i {
	color: var(--primary);
}

/* ================================================================
   CLASSES GRID
   ================================================================ */

.classes-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
}

.class-section h4 {
	font-size: 1rem;
	font-weight: 700;
	color: var(--primary);
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.class-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.class-list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.5rem 0.75rem;
	background: white;
	border-radius: 8px;
	font-size: 0.9rem;
}

.class-name {
	font-weight: 700;
	color: var(--primary);
}

.teacher {
	color: var(--text-light);
	font-size: 0.85rem;
}

/* ================================================================
   PRIMAIRE GRID
   ================================================================ */

.primaire-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
}

.primaire-year {
	background: white;
	padding: 0.75rem;
	border-radius: 10px;
	text-align: center;
}

.year-badge {
	display: block;
	font-weight: 800;
	color: var(--success);
	font-size: 1.1rem;
	margin-bottom: 0.25rem;
}

.letters {
	font-size: 0.8rem;
	color: var(--text-light);
	font-weight: 500;
}

/* ================================================================
   CODE NOTICE
   ================================================================ */

.code-notice {
	margin-top: 1.25rem;
	padding: 0.75rem 1rem;
	background: white;
	border-radius: 8px;
	font-size: 0.9rem;
	color: var(--text-light);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.code-notice i {
	color: var(--secondary);
}

/* ================================================================
   STAFF ACCESS — included for future use
   ================================================================ */

.staff-access {
	border: 2px dashed #E5E7EB;
	background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
}

/* ================================================================
   RESPONSIVE — 768px
   ================================================================ */

@media (max-width: 768px) {
	.classes-grid {
		grid-template-columns: 1fr;
	}

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

	.code-form {
		flex-direction: column;
	}

	.code-form .form-group {
		width: 100%;
	}

	.access-header {
		flex-direction: column;
		text-align: center;
	}
}

/* ================================================================
   ERROR + LOADING STATES
   ================================================================ */

.photos-error {
	color: #d9534f;
	margin-top: 0.75rem;
	font-size: 0.9rem;
	text-align: center;
	width: 100%;
}

.photos-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Loading overlay — shown while fetching album images */
.edb-loading-overlay {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
}

.edb-loading-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top-color: white;
	border-radius: 50%;
	animation: edb-spin 0.8s linear infinite;
}

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

/* ================================================================
   ALBUM CARD GRID
   ================================================================ */

.photos-album-grid {
	padding: 2rem 0;
}

.photos-album-grid-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}

.photos-album-grid-header h2 {
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--dark);
	margin: 0;
}

.photos-back-link {
	color: var(--primary);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	transition: var(--transition);
}

.photos-back-link:hover {
	opacity: 0.75;
}

.album-cards-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 1.5rem;
}

.album-card {
	background: white;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: var(--shadow-md);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.album-card:hover {
	transform: scale(1.02);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.album-card-cover {
	width: 100%;
	height: 200px;
	object-fit: cover;
	display: block;
	background: #e0e7f0;
}

.album-card-info {
	padding: 1rem 1.25rem;
}

.album-card-info h3 {
	font-size: 1rem;
	font-weight: 700;
	color: var(--dark);
	margin: 0 0 0.4rem;
	line-height: 1.3;
}

.album-card-date {
	font-size: 0.85rem;
	color: #666;
	display: block;
}

.no-albums-message {
	text-align: center;
	padding: 3rem 1rem;
	color: #666;
	font-style: italic;
}

/* ================================================================
   GALLERY OVERLAY
   ================================================================ */

.photos-gallery-overlay {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(0, 0, 0, 0.9);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.gallery-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	position: sticky;
	top: 0;
	background: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(4px);
	z-index: 1;
}

.gallery-header h2 {
	color: white;
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0;
}

.gallery-close-btn {
	background: none;
	border: none;
	color: white;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	border-radius: 6px;
	transition: background 0.15s ease;
	flex-shrink: 0;
}

.gallery-close-btn:hover {
	background: rgba(255, 255, 255, 0.15);
}

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.4rem;
	padding: 0.75rem 1rem 1.5rem;
}

.gallery-item {
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	aspect-ratio: 1;
}

.gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	cursor: pointer;
	display: block;
	transition: transform 0.2s ease;
}

.gallery-item:hover img {
	transform: scale(1.05);
}

.gallery-item-download {
	position: absolute;
	bottom: 0.5rem;
	right: 0.5rem;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary, #4169E1);
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	opacity: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.gallery-item-download:hover {
	background: var(--primary-dark, #3457b5);
	color: white;
}

/* Simple full-size lightbox */
.photos-lightbox {
	position: fixed;
	inset: 0;
	z-index: 10001;
	background: rgba(0, 0, 0, 0.95);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: zoom-out;
}

.photos-lightbox img {
	max-width: 90vw;
	max-height: 90vh;
	object-fit: contain;
	border-radius: 4px;
	cursor: default;
}

.photos-lightbox-download {
	position: absolute;
	bottom: 2rem;
	right: 2rem;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary, #4169E1);
	color: white;
	border: none;
	border-radius: 50%;
	font-size: 1.2rem;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	transition: background 0.2s ease, transform 0.2s ease;
	z-index: 10002;
}

.photos-lightbox-download:hover {
	background: var(--primary-dark, #3457b5);
	transform: scale(1.1);
}

/* ================================================================
   RESPONSIVE — album grid + gallery (768px and 480px)
   ================================================================ */

@media (max-width: 768px) {
	.album-cards-container {
		grid-template-columns: repeat(2, 1fr);
	}

	.gallery-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.gallery-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}

	.gallery-close-btn {
		position: absolute;
		top: 0.75rem;
		right: 1rem;
	}

	.gallery-item-download {
		width: 44px;
		height: 44px;
		font-size: 1.1rem;
		border-radius: 10px;
	}

	.photos-album-grid-header {
		flex-direction: column;
		align-items: flex-start;
	}
}

@media (max-width: 480px) {
	.album-cards-container {
		grid-template-columns: 1fr;
	}

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

	.gallery-item-download {
		width: 48px;
		height: 48px;
		font-size: 1.2rem;
		border-radius: 10px;
	}

	.album-card-cover {
		height: 160px;
	}
}

/* ==================== PHOTO CONSENT NOTICE ==================== */
.photos-consent-notice {
	display: none;
	align-items: flex-start;
	gap: 0.85rem;
	background: #FFF7ED;
	border: 1px solid #FED7AA;
	border-left: 4px solid #F59E0B;
	border-radius: 10px;
	padding: 1rem 1.25rem;
	margin-bottom: 1.75rem;
	color: #7C2D12;
	font-size: 0.95rem;
	line-height: 1.55;
}

.photos-consent-notice i {
	color: #D97706;
	font-size: 1.1rem;
	margin-top: 0.15rem;
	flex-shrink: 0;
}

.photos-consent-notice strong {
	display: block;
	color: #78350F;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.photos-consent-notice p {
	margin: 0;
	color: #7C2D12;
}

.photos-consent-notice a {
	color: #B45309;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.photos-consent-notice a:hover {
	color: #78350F;
}

@media (max-width: 600px) {
	.photos-consent-notice {
		padding: 0.85rem 1rem;
		font-size: 0.9rem;
	}
}
