/* CODPilot Frontend Styles */

/* Form Container */
.codpilot-form-wrapper {
    max-width: 600px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.codpilot-form {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
    position: relative;
    overflow: hidden;
}

.codpilot-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* Product Information */
.codpilot-product-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.codpilot-product-name {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
}

.codpilot-product-price {
    font-size: 24px;
    font-weight: 800;
    color: #e74c3c;
    margin-bottom: 5px;
}

.codpilot-product-description {
    font-size: 14px;
    color: #6c757d;
    margin-top: 10px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-group label .required {
    color: #e74c3c;
    margin-left: 3px;
}

/* Form Inputs */
.codpilot-form input[type="text"],
.codpilot-form input[type="tel"],
.codpilot-form input[type="email"],
.codpilot-form input[type="number"],
.codpilot-form select,
.codpilot-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background-color: #ffffff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.codpilot-form input:focus,
.codpilot-form select:focus,
.codpilot-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: #fafbfc;
}

.codpilot-form input::placeholder,
.codpilot-form textarea::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* Textarea */
.codpilot-form textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Select */
.codpilot-form select {
    cursor: pointer;
    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;
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 200px;
}

.quantity-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
}

.quantity-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.quantity-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.quantity-input {
    width: 80px !important;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

/* Submit Button */
.codpilot-submit-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.codpilot-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.codpilot-submit-btn:hover::before {
    left: 100%;
}

.codpilot-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

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

.codpilot-submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.codpilot-submit-btn:disabled::before {
    display: none;
}

/* Loading State */
.codpilot-submit-btn.loading {
    position: relative;
    color: transparent;
}

.codpilot-submit-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

.codpilot-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

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

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

.codpilot-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

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

/* Field Validation */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.field-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.field-success {
    color: #28a745;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Trust Signals */
.codpilot-trust-signals {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.trust-signal {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.trust-signal .icon {
    font-size: 16px;
    color: #28a745;
}

/* Security Badge */
.codpilot-security {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.security-text {
    font-size: 12px;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.security-icon {
    color: #28a745;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .codpilot-form {
        padding: 20px;
        margin: 10px;
        border-radius: 8px;
    }
    
    .codpilot-product-info {
        padding: 15px;
    }
    
    .codpilot-product-name {
        font-size: 18px;
    }
    
    .codpilot-product-price {
        font-size: 20px;
    }
    
    .quantity-selector {
        justify-content: center;
        max-width: none;
    }
    
    .codpilot-submit-btn {
        font-size: 16px;
        padding: 14px 24px;
    }
    
    .codpilot-trust-signals {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .codpilot-form-wrapper {
        margin: 10px 0;
    }
    
    .codpilot-form {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .codpilot-form input,
    .codpilot-form select,
    .codpilot-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .codpilot-form {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .codpilot-product-info {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        border-color: #34495e;
    }
    
    .codpilot-product-name {
        color: #ecf0f1;
    }
    
    .form-group label {
        color: #ecf0f1;
    }
    
    .codpilot-form input,
    .codpilot-form select,
    .codpilot-form textarea {
        background-color: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .codpilot-form input:focus,
    .codpilot-form select:focus,
    .codpilot-form textarea:focus {
        background-color: #3d566e;
        border-color: #667eea;
    }
    
    .codpilot-form input::placeholder,
    .codpilot-form textarea::placeholder {
        color: #95a5a6;
    }
    
    .codpilot-trust-signals {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .trust-signal {
        color: #bdc3c7;
    }
    
    .security-text {
        color: #bdc3c7;
    }
}

/* Animation for form appearance */
.codpilot-form-wrapper {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Hover effects for better UX */
.form-group {
    transition: all 0.3s ease;
}

.form-group:hover label {
    color: #667eea;
}

/* Focus within for better accessibility */
.form-group:focus-within label {
    color: #667eea;
    transform: translateY(-2px);
}

/* Custom checkbox/radio styles if needed */
.codpilot-checkbox,
.codpilot-radio {
    position: relative;
    display: inline-block;
    margin-right: 10px;
}

.codpilot-checkbox input,
.codpilot-radio input {
    width: auto !important;
    margin-right: 8px;
}

/* Print styles */
@media print {
    .codpilot-form-wrapper {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .codpilot-submit-btn {
        display: none;
    }
}
