/**
 * Plus Collage - Frontend Styles
 */

/* CSS Variables */
:root {
    --plus-collage-radius: 8px;
    --plus-collage-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --plus-collage-transition: all 0.3s ease;
}

/* ==========================================================================
   COLLAGE DISPLAY
   ========================================================================== */

.foal-collage {
    --collage-bg: #2c3e50;
    --collage-text: #ffffff;
    --collage-accent: #c9a227;
    
    max-width: 1200px;
    margin: 2rem auto;
    border-radius: var(--plus-collage-radius);
    overflow: hidden;
    box-shadow: var(--plus-collage-shadow);
    background: #f8f9fa;
}

.collage-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 500px;
}

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

/* Info Panel */
.collage-info-panel {
    background: var(--collage-bg);
    color: var(--collage-text);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-content {
    position: relative;
}

.foal-name-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--collage-accent);
}

.foal-name {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--collage-text);
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.foal-gender {
    display: inline-block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--collage-accent);
    font-weight: 500;
}

.foal-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.detail-row.pedigree {
    margin: 0.25rem 0;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    color: var(--collage-text);
}

.detail-value {
    font-size: 1rem;
    color: var(--collage-text);
}

.detail-value.sire-name,
.detail-value.dam-name {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.1rem;
    color: var(--collage-accent);
    font-weight: 500;
}

.detail-divider {
    height: 1px;
    background: linear-gradient(to right, var(--collage-accent), transparent);
    margin: 0.75rem 0;
    opacity: 0.5;
}

.info-decoration {
    margin-top: 2rem;
    opacity: 0.3;
}

.decoration-line {
    width: 80px;
    height: 20px;
    color: var(--collage-accent);
}

/* Photo Grid */
.collage-photos {
    display: grid;
    gap: 4px;
    padding: 4px;
    background: #e9ecef;
}

/* 3 Photos Layout */
.collage-photos-3 .collage-photos {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.collage-photos-3 .photo-1 {
    grid-row: span 2;
}

/* 4 Photos Layout */
.collage-photos-4 .collage-photos {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 5 Photos Layout */
.collage-photos-5 .collage-photos {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.collage-photos-5 .photo-1 {
    grid-column: span 2;
}

/* 6 Photos Layout */
.collage-photos-6 .collage-photos {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.collage-photo {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
}

.collage-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.collage-photo:hover img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.collage-photo:hover .photo-overlay {
    opacity: 1;
}

.zoom-icon {
    font-size: 2rem;
}

/* ==========================================================================
   GALLERY / ARCHIVE VIEW
   ========================================================================== */

.foal-gallery {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

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

@media (max-width: 900px) {
    .foal-gallery.columns-3,
    .foal-gallery.columns-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .foal-gallery { grid-template-columns: 1fr !important; }
}

.foal-card {
    background: #fff;
    border-radius: var(--plus-collage-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: var(--plus-collage-transition);
}

.foal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.foal-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.foal-card-image {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f0f0f0;
}

.foal-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.foal-card:hover .foal-card-image img {
    transform: scale(1.08);
}

.placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.foal-card-content {
    padding: 1.25rem;
    border-top: 3px solid var(--card-accent, #c9a227);
}

.foal-card-name {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

.foal-card-meta {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 0.5rem 0;
}

.foal-card-meta .separator {
    margin: 0 0.5rem;
}

.foal-card-pedigree {
    font-size: 0.9rem;
    color: #888;
    margin: 0;
    font-style: italic;
}

/* ==========================================================================
   FORM STYLES
   ========================================================================== */

.plus-collage-form-wrapper {
    max-width: 900px;
    margin: 2rem auto;
}

.plus-collage-form {
    background: #fff;
    border-radius: var(--plus-collage-radius);
    box-shadow: var(--plus-collage-shadow);
    overflow: hidden;
}

.form-section {
    padding: 2rem;
    border-bottom: 1px solid #e9ecef;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

.section-description {
    color: #666;
    margin: 0 0 1.5rem 0;
    font-size: 0.95rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-field {
    display: flex;
    flex-direction: column;
}

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

.form-field .required {
    color: #d63638;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field select {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #2c3e50;
}

/* Photo Upload Area */
.photo-upload-area {
    margin-top: 1rem;
}

.upload-dropzone {
    border: 3px dashed #d0d0d0;
    border-radius: var(--plus-collage-radius);
    padding: 3rem 2rem;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
}

.upload-dropzone.drag-over {
    border-color: #2c3e50;
    background: #f0f4f8;
}

.dropzone-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.upload-dropzone p {
    color: #666;
    margin: 0 0 1rem 0;
}

.upload-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #2c3e50;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.upload-button:hover {
    background: #1a252f;
}

#photo-input {
    display: none;
}

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.photo-preview-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .remove-photo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(214, 54, 56, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-preview-item:hover .remove-photo {
    opacity: 1;
}

.photo-preview-item .photo-order {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.photo-preview-item.uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-counter {
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.min-photos-notice {
    color: #d63638;
}

/* Color Fields */
.color-row {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 600px) {
    .color-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

.color-field label {
    font-size: 0.85rem;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-input-wrapper input[type="color"] {
    width: 50px;
    height: 36px;
    padding: 0;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}

.color-label {
    font-family: monospace;
    font-size: 0.85rem;
    color: #666;
}

.color-presets {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.presets-label {
    font-size: 0.9rem;
    color: #666;
}

.color-preset {
    display: flex;
    gap: 2px;
    padding: 4px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-preset:hover {
    border-color: #2c3e50;
    transform: scale(1.05);
}

.color-preset span {
    width: 24px;
    height: 24px;
    border-radius: 3px;
}

/* Submit Section */
.submit-section {
    background: #f8f9fa;
    text-align: center;
}

.form-messages {
    margin-bottom: 1rem;
}

.form-messages .error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.form-messages .success {
    background: #f0fdf4;
    color: #166534;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 220px;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
}

.submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Live Preview */
.collage-live-preview {
    margin-top: 2rem;
}

.collage-live-preview h3 {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
    color: #2c3e50;
}

.preview-placeholder {
    background: #f8f9fa;
    padding: 3rem;
    text-align: center;
    color: #666;
    border-radius: var(--plus-collage-radius);
    border: 2px dashed #d0d0d0;
}

/* Login Notice */
.plus-collage-login-notice {
    max-width: 500px;
    margin: 3rem auto;
    padding: 3rem;
    background: #fff;
    border-radius: var(--plus-collage-radius);
    box-shadow: var(--plus-collage-shadow);
    text-align: center;
}

.plus-collage-login-notice .notice-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.plus-collage-login-notice h3 {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

.plus-collage-login-notice p {
    color: #666;
    margin: 0 0 1.5rem 0;
}

.login-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #2c3e50;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.login-button:hover {
    background: #1a252f;
    color: #fff;
}

.register-link {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.register-link a {
    color: #2c3e50;
    font-weight: 500;
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */

.plus-collage-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.plus-collage-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ==========================================================================
   NO RESULTS
   ========================================================================== */

.no-foals {
    text-align: center;
    padding: 3rem;
    color: #666;
    background: #f8f9fa;
    border-radius: var(--plus-collage-radius);
}

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

@media print {
    .foal-collage {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .collage-photo:hover img {
        transform: none;
    }
    
    .photo-overlay {
        display: none;
    }
}
