/**
 * Family Tree Frontend Form Styles
 * Professional styling for frontend member addition form
 */

/* Container and Layout */
.family-tree-frontend-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.family-tree-form-wrapper {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

/* Header */
.family-tree-form-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

/* Login section tweaks */
.family-tree-form-wrapper .login form p {
    margin-bottom: 12px;
}
.family-tree-form-wrapper .login label {
    display: block;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 6px;
}
.family-tree-form-wrapper .login input[type="text"],
.family-tree-form-wrapper .login input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    background: #fafbfc;
}
.family-tree-form-wrapper .login .button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
}

.family-tree-form-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.family-tree-form-description {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 300;
}

/* Form Sections */
.form-section {
    padding: 40px;
    border-bottom: 1px solid #f0f2f5;
}

.form-section:last-child {
    border-bottom: none;
}

.section-title {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8f4f8;
}

.section-icon {
    font-size: 1.8rem;
    margin-right: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.required {
    color: #e74c3c;
    margin-left: 4px;
    font-weight: bold;
}

/* Form Inputs */
.form-input,
.form-select,
.form-textarea {
    padding: 14px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #2c3e50;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: #bdc3c7;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Auto-capitalize common name fields visually */
#first_name,
#middle_name,
#last_name,
#alternative_name {
    text-transform: capitalize;
}

/* Photo Upload */
.photo-upload-container {
    position: relative;
}

.photo-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.photo-preview {
    border: 2px dashed #bdc3c7;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    cursor: pointer;
}

.photo-preview:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.photo-placeholder {
    color: #7f8c8d;
}

.photo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.photo-preview.has-image {
    padding: 0;
    border: 2px solid #27ae60;
    background: #ffffff;
}

.photo-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
}

/* Buttons */
.form-actions {
    padding: 40px;
    background: #f8f9fa;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #ffffff;
    color: #7f8c8d;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #bdc3c7;
    transform: translateY(-1px);
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.2rem;
}

.btn-icon {
    font-size: 1.3rem;
}

/* Messages */
.form-messages {
    margin-top: 20px;
}

.message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-icon {
    font-size: 1.2rem;
}

/* Loading */
.form-loading {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e5e9;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .family-tree-frontend-form-container {
        padding: 10px;
    }
    
    .family-tree-form-header {
        padding: 30px 20px;
    }
    
    .family-tree-form-title {
        font-size: 2rem;
    }
    
    .form-section {
        padding: 30px 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .form-actions {
        padding: 30px 20px;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .family-tree-form-title {
        font-size: 1.8rem;
    }
    
    .family-tree-form-description {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 12px 14px;
    }
}

/* Form Validation States */
.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-input.success,
.form-select.success,
.form-textarea.success {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Accessibility */
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Animation for form sections */
.form-section {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for form sections */
.form-section:nth-child(1) { animation-delay: 0.1s; }
.form-section:nth-child(2) { animation-delay: 0.2s; }
.form-section:nth-child(3) { animation-delay: 0.3s; }
.form-section:nth-child(4) { animation-delay: 0.4s; }
.form-section:nth-child(5) { animation-delay: 0.5s; }
.form-section:nth-child(6) { animation-delay: 0.6s; }

/* Custom select styling */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Enhanced hover effects */
.form-group:hover .form-label {
    color: #667eea;
}

/* Success state for completed sections */
.form-section.completed .section-title {
    color: #27ae60;
}

.form-section.completed .section-title::after {
    content: "✓";
    margin-left: 10px;
    color: #27ae60;
    font-weight: bold;
}

/* reCAPTCHA Styles */
.recaptcha-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 20px 0;
}

.g-recaptcha-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.recaptcha-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
    font-weight: 500;
}

.recaptcha-info {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
    font-weight: 500;
}

.recaptcha-loading {
    background: #fff3cd;
    color: #856404;
    padding: 15px;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
    font-weight: 500;
}

/* reCAPTCHA widget styling */
.g-recaptcha {
    margin: 0 auto;
    display: block;
}

/* Responsive reCAPTCHA */
@media (max-width: 768px) {
    .g-recaptcha-container {
        min-height: 60px;
    }
    
    .recaptcha-error,
    .recaptcha-info,
    .recaptcha-loading {
        padding: 12px;
        font-size: 14px;
    }
}