/**
 * Frontend Styles for Lead Form Tracker
 */

/* Form Container */
.lft-form {
    max-width: 600px;
    margin: 20px 0;
    font-family: inherit;
}

.lft-form * {
    box-sizing: border-box;
}

/* Form Inner */
.lft-form-inner {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

/* Form Fields */
.lft-form-fields {
    margin-bottom: 25px;
}

.lft-form-row {
    margin-bottom: 20px;
}

.lft-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.lft-required {
    color: #dc3545;
    margin-left: 3px;
}

/* Input Styles */
.lft-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    transition: all 0.3s ease;
    background-color: #fff;
    color: #333;
}

.lft-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.lft-input::placeholder {
    color: #999;
    opacity: 1;
}

.lft-input-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* Error States */
.lft-input.lft-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.lft-error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
    display: none;
}

.lft-error-message[style*="block"] {
    display: block !important;
}

/* Submit Button */
.lft-form-submit {
    text-align: center;
    margin-bottom: 20px;
}

.lft-submit-btn {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
    position: relative;
    overflow: hidden;
}

.lft-submit-btn:hover {
    background: linear-gradient(135deg, #005a87, #004066);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 124, 186, 0.4);
}

.lft-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.3);
}

.lft-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.lft-submit-btn:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

.lft-submit-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: lft-spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

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

.lft-success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    font-weight: 500;
    display: none;
}

.lft-error-message-global {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    font-weight: 500;
    display: none;
}

/* RTL Support */
.lft-form.rtl {
    direction: rtl;
    text-align: right;
}

.lft-form.rtl .lft-required {
    margin-left: 0;
    margin-right: 3px;
}

.lft-form.rtl .lft-success-message {
    border-left: none;
    border-right: 4px solid #28a745;
}

.lft-form.rtl .lft-error-message-global {
    border-left: none;
    border-right: 4px solid #dc3545;
}

/* HTML Forms */
.lft-html-form form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

.lft-html-form input,
.lft-html-form textarea,
.lft-html-form select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.lft-html-form input:focus,
.lft-html-form textarea:focus,
.lft-html-form select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.lft-html-form button,
.lft-html-form input[type="submit"] {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
    margin: 10px 0;
}

.lft-html-form button:hover,
.lft-html-form input[type="submit"]:hover {
    background: linear-gradient(135deg, #005a87, #004066);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 124, 186, 0.4);
}

/* Theme Compatibility */
.lft-form input,
.lft-form textarea,
.lft-form button {
    font-family: inherit;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lft-form-inner,
    .lft-html-form form {
        padding: 20px;
        margin: 10px;
    }
    
    .lft-submit-btn {
        width: 100%;
        padding: 15px;
    }
    
    .lft-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .lft-form-inner,
    .lft-html-form form {
        padding: 15px;
        border-radius: 4px;
    }
    
    .lft-form-row {
        margin-bottom: 15px;
    }
    
    .lft-input {
        padding: 10px 12px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .lft-input {
        border-width: 3px;
    }
    
    .lft-submit-btn {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .lft-input,
    .lft-submit-btn,
    .lft-submit-loading {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    .lft-form {
        break-inside: avoid;
    }
    
    .lft-submit-btn {
        display: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .lft-form-inner,
    .lft-html-form form {
        background: #1a1a1a;
        border-color: #333;
        color: #fff;
    }
    
    .lft-label {
        color: #fff;
    }
    
    .lft-input {
        background-color: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .lft-input::placeholder {
        color: #aaa;
    }
    
    .lft-input:focus {
        border-color: #4a9eff;
        box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
    }
}

/* Loading State Overlay */
.lft-form.lft-loading {
    position: relative;
    pointer-events: none;
}

.lft-form.lft-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    z-index: 10;
}

/* Success State Animation */
.lft-form.lft-success .lft-success-message {
    animation: lft-slideDown 0.5s ease-out;
}

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

/* Custom Checkbox and Radio Styles */
.lft-html-form input[type="checkbox"],
.lft-html-form input[type="radio"] {
    width: auto;
    margin-right: 8px;
    accent-color: #007cba;
}

.lft-html-form.rtl input[type="checkbox"],
.lft-html-form.rtl input[type="radio"] {
    margin-right: 0;
    margin-left: 8px;
}

/* Select Dropdown Styling */
.lft-html-form select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

.lft-html-form.rtl select {
    background-position: left 12px center;
    padding-right: 16px;
    padding-left: 40px;
}

/* Fieldset and Legend Styling */
.lft-html-form fieldset {
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.lft-html-form legend {
    font-weight: 600;
    padding: 0 10px;
    color: #333;
}

/* Focus Visible for Better Accessibility */
.lft-input:focus-visible,
.lft-submit-btn:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Invalid State */
.lft-input:invalid {
    border-color: #dc3545;
}

.lft-input:invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}