/**
 * GPS Contact Manager - Custom Forms Styles
 * Designed to work with both light and dark themed pages
 */

/* Form Wrapper */
.gps-cm-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

.gps-cm-form-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Form Layout */
.gps-cm-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.gps-cm-form-row {
    display: flex;
    flex-direction: column;
}

.gps-cm-two-col {
    flex-direction: row;
    gap: 1rem;
}

.gps-cm-two-col .gps-cm-field {
    flex: 1;
}

@media (max-width: 600px) {
    .gps-cm-two-col {
        flex-direction: column;
    }
}

/* Field Styling */
.gps-cm-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gps-cm-field label {
    font-weight: 600;
    font-size: 0.9375rem;
}

.gps-cm-field .required {
    color: #dc2626;
}

.gps-cm-field input[type="text"],
.gps-cm-field input[type="email"],
.gps-cm-field input[type="tel"],
.gps-cm-field select,
.gps-cm-field textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    color: #1a1a1a;
}

.gps-cm-field input:focus,
.gps-cm-field select:focus,
.gps-cm-field textarea:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.gps-cm-field input::placeholder,
.gps-cm-field textarea::placeholder {
    color: #9ca3af;
}

.gps-cm-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.gps-cm-field textarea {
    resize: vertical;
    min-height: 120px;
}

.gps-cm-field-note {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0.25rem 0 0 0;
}

/* Checkbox Styling */
.gps-cm-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gps-cm-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: normal;
}

.gps-cm-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.125rem 0 0 0;
    cursor: pointer;
    accent-color: #dc2626;
    flex-shrink: 0;
}

.gps-cm-checkbox span {
    line-height: 1.5;
}

.gps-cm-consent {
    background: rgba(0, 0, 0, 0.03);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Honeypot - Hidden from users */
.gps-cm-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* Submit Button */
.gps-cm-submit-row {
    margin-top: 0.5rem;
}

.gps-cm-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 180px;
}

.gps-cm-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.gps-cm-submit-btn:active {
    transform: translateY(0);
}

.gps-cm-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.gps-cm-submit-btn .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gps-spin 0.8s linear infinite;
}

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

/* Form Messages */
.gps-cm-form-message {
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 1rem;
}

.gps-cm-form-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.gps-cm-form-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Dark Theme Styles */
/* Applied when form is inside a dark-themed container */
.gps-dark .gps-cm-form-wrapper,
[style*="background"][style*="#0a0a"] .gps-cm-form-wrapper,
[style*="background"][style*="#1a1a"] .gps-cm-form-wrapper {
    color: #fff;
}

.gps-dark .gps-cm-form-title,
[style*="background"][style*="#0a0a"] .gps-cm-form-title,
[style*="background"][style*="#1a1a"] .gps-cm-form-title {
    color: #fff;
}

.gps-dark .gps-cm-field label,
[style*="background"][style*="#0a0a"] .gps-cm-field label,
[style*="background"][style*="#1a1a"] .gps-cm-field label {
    color: #e5e7eb;
}

.gps-dark .gps-cm-field input,
.gps-dark .gps-cm-field select,
.gps-dark .gps-cm-field textarea,
[style*="background"][style*="#0a0a"] .gps-cm-field input,
[style*="background"][style*="#0a0a"] .gps-cm-field select,
[style*="background"][style*="#0a0a"] .gps-cm-field textarea,
[style*="background"][style*="#1a1a"] .gps-cm-field input,
[style*="background"][style*="#1a1a"] .gps-cm-field select,
[style*="background"][style*="#1a1a"] .gps-cm-field textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.gps-dark .gps-cm-field input:focus,
.gps-dark .gps-cm-field select:focus,
.gps-dark .gps-cm-field textarea:focus,
[style*="background"][style*="#0a0a"] .gps-cm-field input:focus,
[style*="background"][style*="#0a0a"] .gps-cm-field select:focus,
[style*="background"][style*="#0a0a"] .gps-cm-field textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #dc2626;
}

.gps-dark .gps-cm-field input::placeholder,
.gps-dark .gps-cm-field textarea::placeholder,
[style*="background"][style*="#0a0a"] .gps-cm-field input::placeholder,
[style*="background"][style*="#0a0a"] .gps-cm-field textarea::placeholder {
    color: #6b7280;
}

.gps-dark .gps-cm-checkbox span,
[style*="background"][style*="#0a0a"] .gps-cm-checkbox span,
[style*="background"][style*="#1a1a"] .gps-cm-checkbox span {
    color: #e5e7eb;
}

.gps-dark .gps-cm-field-note,
[style*="background"][style*="#0a0a"] .gps-cm-field-note,
[style*="background"][style*="#1a1a"] .gps-cm-field-note {
    color: #9ca3af;
}

.gps-dark .gps-cm-consent,
[style*="background"][style*="#0a0a"] .gps-cm-consent,
[style*="background"][style*="#1a1a"] .gps-cm-consent {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.gps-dark .gps-cm-form-message.success,
[style*="background"][style*="#0a0a"] .gps-cm-form-message.success {
    background: rgba(22, 101, 52, 0.2);
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.3);
}

.gps-dark .gps-cm-form-message.error,
[style*="background"][style*="#0a0a"] .gps-cm-form-message.error {
    background: rgba(153, 27, 27, 0.2);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.3);
}

/* Join Form - Full width on larger screens */
.gps-cm-join-form .gps-cm-form-wrapper {
    max-width: 700px;
}

/* Validation States */
.gps-cm-field.has-error input,
.gps-cm-field.has-error select,
.gps-cm-field.has-error textarea {
    border-color: #dc2626;
}

.gps-cm-field .error-message {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Animation for success state */
.gps-cm-form.success {
    animation: gps-fade-out 0.3s ease forwards;
}

@keyframes gps-fade-out {
    to {
        opacity: 0.5;
        pointer-events: none;
    }
}
