/**
 * FSP Forms Styles
 * Contact forms, CF7 integration, file upload, and form overlays
 *
 * @package Free_Style_Products
 */

/* ==========================================================================
   Contact Section
   ========================================================================== */

.contact-section {
    background-color: var(--hw-dark-secondary);
}

.contact-form-wrapper {
    background: var(--hw-dark-tertiary);
    border-radius: var(--hw-radius-lg);
    padding: 50px;
    border: 1px solid var(--hw-gray);
}

/* Form Labels - Works for both custom and CF7 forms */
.contact-form-wrapper .form-label {
    font-weight: 600;
    color: var(--hw-white);
    margin-bottom: 8px;
    display: block;
}

/* Form Controls - Works for both custom and CF7 forms */
.contact-form-wrapper .form-control {
    background: var(--hw-dark-secondary);
    border: 2px solid var(--hw-gray);
    color: var(--hw-white);
    padding: 15px 20px;
    border-radius: var(--hw-radius);
    transition: var(--hw-transition);
    width: 100%;
}

.contact-form-wrapper .form-control:focus {
    background: var(--hw-dark-secondary);
    border-color: var(--hw-primary);
    color: var(--hw-white);
    box-shadow: 0 0 0 3px rgba(44, 198, 77, 0.2);
    outline: none;
}

.contact-form-wrapper .form-control::placeholder {
    color: var(--hw-gray-light);
}

.contact-form-wrapper .form-text {
    color: var(--hw-gray-lighter);
    font-size: 0.8rem;
    margin-top: 5px;
}

.contact-form-wrapper textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ==========================================================================
   Upload Wrapper
   ========================================================================== */

.upload-wrapper {
    position: relative;
}

.upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* CF7 wraps file input in span and p - hide these */
.upload-wrapper .wpcf7-form-control-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.upload-wrapper .wpcf7-form-control-wrap p {
    margin: 0;
    height: 100%;
}

.upload-wrapper .wpcf7-file {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    background: var(--hw-dark-secondary);
    border: 2px dashed var(--hw-gray);
    border-radius: var(--hw-radius);
    padding: 40px 20px;
    text-align: center;
    transition: var(--hw-transition);
    cursor: pointer;
    position: relative;
}

.upload-placeholder p {
    margin: 0;
}

.upload-placeholder svg {
    color: var(--hw-gray-lighter);
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.upload-placeholder span {
    display: block;
    color: var(--hw-white);
    font-weight: 500;
    margin-bottom: 5px;
}

.upload-placeholder small {
    display: block;
    color: var(--hw-gray-lighter);
    font-size: 0.8rem;
}

.upload-wrapper:hover .upload-placeholder,
.upload-wrapper.drag-over .upload-placeholder {
    border-color: var(--hw-primary);
    background: rgba(44, 198, 77, 0.05);
}

.upload-placeholder.has-file {
    border-style: solid;
    border-color: var(--hw-success);
}

.upload-placeholder.has-file svg {
    color: var(--hw-success);
}

/* ==========================================================================
   Contact Form 7 Compatibility
   ========================================================================== */

/* Reset CF7 default paragraph margins */
.contact-form-wrapper .wpcf7-form p {
    margin-bottom: 0;
}

.contact-form-wrapper .form-group p {
    margin-bottom: 0;
}

/* CF7 form control wrap */
.contact-form-wrapper .wpcf7-form-control-wrap {
    display: block;
    margin-top: 8px;
}

/* CF7 Submit Button */
.contact-form-wrapper .wpcf7-submit {
    background: linear-gradient(135deg, var(--hw-primary) 0%, var(--hw-primary-dark) 100%);
    border: none;
    color: var(--hw-dark);
    font-weight: 600;
    padding: 12px 30px;
    border-radius: var(--hw-radius);
    transition: var(--hw-transition);
    cursor: pointer;
}

.contact-form-wrapper .wpcf7-submit:hover,
.contact-form-wrapper .wpcf7-submit:focus {
    background: linear-gradient(135deg, var(--hw-primary-light) 0%, var(--hw-primary) 100%);
    color: var(--hw-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(44, 198, 77, 0.4);
}

/* CF7 Spinner - Hidden since we use custom */
.contact-form-wrapper .wpcf7-spinner {
    display: none !important;
}

/* CF7 Validation Errors */
.contact-form-wrapper .wpcf7-not-valid-tip {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

.contact-form-wrapper .wpcf7-not-valid {
    border-color: #ff6b6b !important;
}

/* CF7 Response Messages */
.contact-form-wrapper .wpcf7-response-output {
    margin: 20px 0 0;
    padding: 15px 20px;
    border-radius: var(--hw-radius);
    text-align: center;
}

.contact-form-wrapper .wpcf7-form.sent .wpcf7-response-output {
    background: rgba(44, 198, 77, 0.1);
    border: 1px solid var(--hw-primary);
    color: var(--hw-primary);
}

.contact-form-wrapper .wpcf7-form.failed .wpcf7-response-output,
.contact-form-wrapper .wpcf7-form.aborted .wpcf7-response-output {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
}

.contact-form-wrapper .wpcf7-form.invalid .wpcf7-response-output {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    color: #ffc107;
}

/* Hide screen reader text but keep accessible */
.contact-form-wrapper .screen-reader-response {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   File Upload Preview
   ========================================================================== */

.file-preview-container {
    background: var(--hw-dark-secondary);
    border: 2px solid var(--hw-primary);
    border-radius: var(--hw-radius);
    padding: 20px;
    margin-top: 0;
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.file-preview-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: var(--hw-dark);
    border-radius: var(--hw-radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-preview-info {
    flex-grow: 1;
    min-width: 0;
}

.file-preview-info .file-name {
    display: block;
    color: var(--hw-white);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-info .file-size {
    display: block;
    color: var(--hw-gray-lighter);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.file-preview-info .file-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-preview-info .status-icon {
    color: var(--hw-primary);
}

.file-preview-info .status-text {
    color: var(--hw-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.file-remove-btn {
    flex-shrink: 0;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--hw-transition);
    color: #ff6b6b;
}

.file-remove-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
}

.file-progress-bar {
    margin-top: 15px;
    height: 4px;
    background: var(--hw-dark);
    border-radius: 2px;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.file-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hw-primary) 0%, var(--hw-primary-light) 100%);
    border-radius: 2px;
    transition: width 0.2s ease;
    width: 0%;
}

/* ==========================================================================
   Form Submit Overlay & Spinner
   ========================================================================== */

.form-submit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 23, 23, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--hw-radius-lg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100;
}

.form-submit-overlay.active {
    opacity: 1;
    visibility: visible;
}

.submit-overlay-content {
    text-align: center;
}

.submit-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
}

.spinner-icon {
    width: 100%;
    height: 100%;
    animation: rotate 1.5s linear infinite;
}

.spinner-path {
    stroke: var(--hw-primary);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.submit-text {
    color: var(--hw-white);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* Form Success */
.form-success {
    display: none;
    text-align: center;
    padding: 60px 20px;
}

.form-success svg {
    color: var(--hw-success);
    margin-bottom: 25px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.form-success h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--hw-white);
}

.form-success p {
    color: var(--hw-gray-lighter);
    max-width: 400px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 767.98px) {
    .contact-form-wrapper {
        padding: 30px 20px;
    }
}
