/**
 * PMD Custom Forms - Frontend Styles
 * Author: Purple Moon Designs
 * Author URI: https://www.purplemoondesigns.co.uk
 * Multi-step Typeform-style design
 */

/* Container */
.pmd-form-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Header */
.pmd-form-header {
    background: #ffffff;
    padding: 40px;
    text-align: center;
    color: #100D3B;
}

.pmd-form-header h2 {
    margin: 0 0 15px 0;
    font-size: 32px;
    font-weight: 700;
    color: #100D3B;
}

.pmd-form-description {
    color: rgba(16, 13, 59, 0.75);
    font-size: 16px;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Progress Bar - Inside Header */
.pmd-form-header .pmd-progress-container {
    margin-top: 30px;
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
}

.pmd-progress-bar {
    height: 6px;
    background: #E5E7EB;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 20px;
}

.pmd-progress-fill {
    height: 100%;
    background: #DC098C;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    border-radius: 10px;
}

.pmd-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.pmd-progress-text {
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #ffffff;
    font-weight: 500;
    gap: 20px;
}

.pmd-step-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pmd-step-counter {
    color: #100D3B;
    font-weight: 700;
    font-size: 16px;
}

.pmd-step-name {
    color: #100D3B;
    font-size: 14px;
    font-weight: 500;
}

/* Step Indicators - In Header */
.pmd-step-indicators {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pmd-step-dot {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #E5E7EB;
    background: #ffffff;
    color: #100D3B;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pmd-step-dot:hover { transform: none; }

.pmd-step-dot.completed {
    border-color: #6FCCDD;
    background: #EFFFFA;
    color: #100D3B;
}
fieldset.pmd-radio-group {
    width: calc(100% - 40px);
    padding: 13px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    color: #1e293b;
    background: #fff;
    transition: all 0.3s 
cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}


fieldset.pmd-checkbox-group {
    width: calc(100% - 40px);
    padding: 13px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    color: #1e293b;
    background: #fff;
    transition: all 0.3s 
cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pmd-form-field.pmd-field-checkbox {
    width: calc(100% - 40px);
    padding: 13px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    color: #1e293b;
    background: #fff;
    transition: all 0.3s 
cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pmd-step-dot.completed::after {
    content: '✓';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pmd-step-dot.active {
    border-color: #DC098C;
    background: #DC098C;
    color: #ffffff;
    transform: none;
    box-shadow: none;
    text-shadow: none;
}

.pmd-step-dot.active:hover { transform: none; }

/* Form Sections - Multi-step */
.pmd-form-section {
    display: none;
    padding: 40px;
    min-height: 500px;
    animation: fadeIn 0.4s ease-in-out;
}

.pmd-form-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pmd-section-title {
    margin: 0 0 30px 0;
    padding-bottom: 20px;
    font-size: 28px;
    color: #100D3B;
    font-weight: 700;
    position: relative;
}

.pmd-section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: #DC098C;
}

.pmd-progress-container {
    padding: 0 10px;
}

/* Form Fields */
.pmd-form-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.pmd-form-field {
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.pmd-form-field:focus-within { transform: none; }

.pmd-form-field.pmd-field-textarea,
.pmd-form-field.pmd-field-checkbox_group,
.pmd-form-field.pmd-field-repeater {
    grid-column: 1 / -1;
}

.pmd-field-label {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Input Styles */
.pmd-input,
.pmd-select,
.pmd-textarea {
    width: calc(100% - 40px);
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    color: #1e293b;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}


.pmd-select {
    width: 100%;
}

.pmd-input:hover,
.pmd-select:hover,
.pmd-textarea:hover { border-color: #e2e8f0; }

.pmd-input:focus,
.pmd-select:focus,
.pmd-textarea:focus { outline: none; border-color: #6FCCDD; box-shadow: 0 0 0 4px rgba(111, 204, 221, 0.25); background: #fff; }

.pmd-textarea {
    resize: vertical;
    min-height: 80px;
}

.pmd-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
}

/* Checkbox Styles */
.pmd-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    color: #334155;
}

.pmd-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #7c3aed;
}

.pmd-checkbox-group {
    border: none;
    padding: 0;
    margin: 0;
}

.pmd-checkbox-group legend {
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    font-size: 14px;
}

.pmd-checkbox-group .pmd-checkbox-label {
    margin-bottom: 10px;
}

/* Navigation Buttons */
.pmd-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f1f5f9;
}

.pmd-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #7c3aed;
    color: #fff;
    border: none;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pmd-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.pmd-nav-btn:hover {
    background: #6d28d9;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.pmd-nav-btn:hover::before {
    opacity: 1;
}

.pmd-nav-btn:active {
    transform: translateY(0);
}

.pmd-nav-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pmd-nav-btn.secondary {
    background: #fff;
    color: #7c3aed;
    border: 2px solid #7c3aed;
}

.pmd-nav-btn.secondary:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.pmd-prev-btn {
    order: 1;
}

.pmd-next-btn,
.pmd-submit-btn {
    order: 2;
    margin-left: auto;
}

.pmd-submit-btn { background: #DC098C; }

.pmd-submit-btn:hover { background: #DC098C; box-shadow: none; }

.pmd-submit-btn svg {
    flex-shrink: 0;
}

/* Loader */
.pmd-form-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pmd-spin 0.6s linear infinite;
}

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

.pmd-nav-btn .pmd-form-loader {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Response Messages */
.pmd-form-response {
    margin: 30px 40px;
    padding: 20px 24px;
    border-radius: 12px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pmd-form-response.success {
    background: #dcfce7;
    color: #166534;
    border: 2px solid #22c55e;
}

.pmd-form-response.success::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

.pmd-form-response.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.pmd-form-response.error::before {
    content: '✕';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .pmd-form-container {
        margin: 20px;
        border-radius: 12px;
    }
    
    .pmd-form-header {
        padding: 30px 20px;
    }
    
    .pmd-form-header h2 {
        font-size: 24px;
    }
    
    .pmd-form-section {
        padding: 30px 20px;
        min-height: 400px;
    }
    
    .pmd-form-fields {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .pmd-section-title {
        font-size: 22px;
    }
    
    .pmd-form-navigation {
        flex-direction: column-reverse;
        gap: 12px;
    }
    
    .pmd-nav-btn {
        width: 100%;
        justify-content: center;
        order: 0 !important;
        margin-left: 0 !important;
    }
    
    .pmd-progress-text {
        padding: 15px;
        font-size: 13px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .pmd-step-info {
        width: 100%;
        text-align: center;
    }
    
    .pmd-step-indicators {
        gap: 6px;
        justify-content: center;
        width: 100%;
    }
    
    .pmd-step-dot {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .pmd-step-dot.completed::after {
        width: 18px;
        height: 18px;
        font-size: 10px;
        top: -3px;
        right: -3px;
    }
    
    .pmd-progress-bar {
        margin-bottom: 15px;
    }
}

/* Date Input Styling */
input[type="date"].pmd-input {
    cursor: pointer;
}

input[type="date"].pmd-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: opacity(0.5);
}

/* Number Input */
input[type="number"].pmd-input {
    -moz-appearance: textfield;
}

input[type="number"].pmd-input::-webkit-outer-spin-button,
input[type="number"].pmd-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Placeholder Styles */
.pmd-input::placeholder,
.pmd-textarea::placeholder {
    color: #94a3b8;
}

/* Focus Within Section */
.pmd-form-section:focus-within {
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* File Upload Fields */
.pmd-file-upload-wrapper {
    grid-column: 1 / -1;
}

.pmd-field-description {
    margin: 8px 0 15px 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    padding: 12px;
    background: #f8fafc;
    border-left: 3px solid #7c3aed;
    border-radius: 4px;
}

.pmd-file-input {
    display: none;
}

.pmd-file-input-container {
    margin-top: 15px;
}

.pmd-file-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #fff;
    padding: 16px 32px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.pmd-file-label:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.pmd-file-label svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.pmd-file-names {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pmd-file-count {
    padding: 12px 16px;
    background: #ede9fe;
    border: 2px solid #7c3aed;
    border-radius: 8px;
    color: #6d28d9;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.pmd-file-count strong {
    font-size: 18px;
    color: #7c3aed;
}

.pmd-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
}

.pmd-file-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pmd-file-item svg {
    flex-shrink: 0;
    color: #7c3aed;
}

.pmd-file-item-name {
    flex: 1;
    font-weight: 500;
    word-break: break-word;
}

.pmd-file-item-size {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: 12px;
}

.pmd-file-hint {
    margin-top: 12px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.8;
}

.pmd-file-hint strong {
    color: #475569;
}

.pmd-file-error {
    margin-top: 12px;
    padding: 12px;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
}

/* Review Section */
.pmd-review-section {
    background: #f8fafc;
}

.pmd-review-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.pmd-review-group {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

.pmd-review-group-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 15px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #7c3aed;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pmd-review-group-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #7c3aed;
    border-radius: 50%;
}

.pmd-review-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.pmd-review-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pmd-review-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pmd-review-field-value {
    font-size: 15px;
    color: #1e293b;
    font-weight: 500;
}

.pmd-review-field-value.empty {
    color: #cbd5e1;
    font-style: italic;
}

.pmd-review-field.full-width {
    grid-column: 1 / -1;
}

.pmd-review-field.full-width .pmd-review-field-value {
    white-space: pre-wrap;
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.pmd-review-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #7c3aed;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
}

.pmd-review-edit-link:hover {
    color: #6d28d9;
}

.pmd-review-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.pmd-review-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
}

.pmd-review-file-item svg {
    color: #7c3aed;
    flex-shrink: 0;
}

.pmd-review-empty {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 15px;
}

.pmd-review-repeater-items {
    margin-top: 8px;
}

.pmd-review-repeater-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    line-height: 1.8;
}

.pmd-review-repeater-item strong {
    color: var(--main);
    font-size: 14px;
    display: block;
    margin-bottom: 6px;
}

/* Empty State */
.pmd-form-field:empty {
    display: none;
}

/* Required Indicator (if needed in future) */
.pmd-field-required::after {
    content: ' *';
    color: #ef4444;
}

/* Repeater Fields */
.pmd-repeater-wrapper {
    margin-bottom: 24px;
    width: 100%;
}

.pmd-repeater-container {
    margin-top: 16px;
    margin-bottom: 16px;
    width: 100%;
}

.pmd-repeater-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.pmd-repeater-item:hover {
    border-color: var(--decor);
    box-shadow: 0 4px 12px rgba(111, 204, 221, 0.1);
}

.pmd-repeater-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.pmd-repeater-item-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.pmd-repeater-item-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--decor);
    border-radius: 50%;
}

.pmd-repeater-remove-btn {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pmd-repeater-remove-btn:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.1);
}

.pmd-repeater-item-fields {
    display: grid;
    gap: 16px;
}

.pmd-repeater-item-fields .pmd-form-field {
    margin-bottom: 0;
}

.pmd-repeater-add-btn {
    background: var(--decor);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.pmd-repeater-add-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 9, 140, 0.3);
}

.pmd-repeater-add-btn svg {
    transition: transform 0.3s ease;
}

.pmd-repeater-add-btn:hover svg {
    transform: rotate(90deg);
}

/* Adjust repeater fields on mobile */
@media (max-width: 768px) {
    .pmd-repeater-item {
        padding: 16px;
    }
    
    .pmd-repeater-item-title {
        font-size: 16px;
    }
    
    .pmd-repeater-add-btn {
        width: 100%;
        justify-content: center;
    }
}

