/**
 * Memorial Manager Pro - Frontend Styles
 */

/* Form Container */
.mmp-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
}

.mmp-form {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mmp-form-section {
    margin-bottom: 40px;
}

.mmp-form-section h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e74c3c;
    color: #413eac;
    font-size: 1.3em;
}

.mmp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.mmp-form-group {
    margin-bottom: 20px;
    position: relative;
}

.mmp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #635dff;
}

.mmp-input,
.mmp-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.mmp-input:focus,
.mmp-textarea:focus {
    outline: none;
    border-color: #e74c3c;
}

.mmp-input-error {
    border-color: #dc3545 !important;
}

.mmp-error {
    display: block;
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

.mmp-input-small {
    max-width: 100px;
}

.mmp-help-text {
    color: #777;
    font-size: 14px;
    margin-bottom: 15px;
}

.mmp-required-label {
    color: #e74c3c;
    font-size: 12px;
    font-weight: normal;
}

/* File Inputs */
.mmp-file-input {
    padding: 10px;
}

.mmp-photo-preview {
    margin-top: 10px;
}

.mmp-photo-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Autocomplete */
#mmp-child-suggestions {
    position: absolute;
    background: #fff;
    border: 2px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    left: 0;
    margin-top: -2px;
}

.mmp-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
    font-size: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.mmp-suggestion-item:last-child {
    border-bottom: none;
}

.mmp-suggestion-item:hover {
    background: #e74c3c;
    color: #fff;
}

.mmp-no-results {
    padding: 12px 15px;
    color: #999;
    font-style: italic;
    font-size: 14px;
}

/* Submit Button */
.mmp-form-actions {
    margin-top: 30px;
    text-align: center;
}

.mmp-button {
    padding: 15px 40px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.mmp-button-primary {
    background: #e74c3c;
    color: #fff;
    font-weight: 600;
}

.mmp-button-primary:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.mmp-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mmp-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Form Messages */
.mmp-form-messages {
    margin-top: 20px;
}

.mmp-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.mmp-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.mmp-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Success Message */
.mmp-success-message {
    text-align: center;
    padding: 50px 30px;
}

.mmp-success-message h3 {
    color: #635dff;
    font-size: 24px;
    margin-bottom: 20px;
}

.mmp-success-message p {
    color: #635dff;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.mmp-success-icon {
    width: 80px;
    height: 80px;
    line-height: 80px;
    margin: 0 auto 20px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    font-size: 50px;
}

.mmp-success-note {
    color: #635dff;
    font-size: 14px;
}

/* Memorial List */
.mmp-memorial-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.mmp-name-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 3;
    column-gap: 30px;
}

.mmp-name-item {
    break-inside: avoid;
    padding: 8px 0;
}

.mmp-name-item a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 16px;
}

.mmp-name-item a:hover {
    color: #e74c3c;
}

.mmp-no-memory {
    color: #999;
}

.mmp-empty-memorial {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
}

/* Popup Modal */
.mmp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2147483646 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mmp-popup-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 2147483647 !important;
}

.mmp-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.mmp-popup-close:hover {
    color: #333;
}

.mmp-popup-header {
    padding: 30px;
}

.mmp-popup-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    padding-bottom: 10px;
}

.mmp-popup-subtitle {
    margin: 0;
    color: #666;
}

.mmp-popup-body {
    padding: 20px 30px 30px;
}

.mmp-memory-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mmp-memory-item {
    margin-bottom: 15px;
}

.mmp-memory-item a {
    display: block;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.mmp-memory-item a:hover {
    transform: translateX(5px);
}

.mmp-memory-submitter {
    display: block;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.mmp-memory-relationship,
.mmp-memory-date {
    display: block;
    font-size: 14px;
    opacity: 0.8;
}

.mmp-memory-item a:hover .mmp-memory-relationship,
.mmp-memory-item a:hover .mmp-memory-date {
    opacity: 1;
}

/* Photo Gallery */
.mmp-photo-gallery {
    margin: 30px 0;
}

.mmp-featured-photo-container {
    margin-bottom: 15px;
}

.mmp-featured-photo {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.3s;
}

.mmp-featured-photo:hover {
    transform: scale(1.02);
}

.mmp-thumbnail-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.mmp-thumbnail {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.mmp-thumbnail:hover {
    transform: scale(1.05);
}

.mmp-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

/* Lightbox */
.mmp-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 2147483647 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mmp-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    z-index: 2147483647 !important;
    position: relative;
}

.mmp-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 4px;
    position: relative;
    z-index: 2147483647 !important;
}

.mmp-lightbox-close,
.mmp-lightbox-prev,
.mmp-lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.9);
    border: none;
    font-size: 40px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.2s;
    z-index: 2147483647 !important;
}

.mmp-lightbox-close {
    top: 20px;
    right: 20px;
}

.mmp-lightbox-prev {
    left: 20px;
}

.mmp-lightbox-next {
    right: 20px;
}

.mmp-lightbox-close:hover,
.mmp-lightbox-prev:hover,
.mmp-lightbox-next:hover {
    background: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .mmp-form {
        padding: 20px;
    }
    
    .mmp-form-row {
        grid-template-columns: 1fr;
    }
    
    .mmp-name-list {
        columns: 1;
    }
    
    .mmp-popup-modal {
        max-height: 90vh;
    }
}
