/* Form styles */
.contract-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-section {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.form-section:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.1);
}

.form-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    position: relative;
}

.form-section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 1px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* Special grid for Personal & Contact Information */
.personal-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.contact-column {
    background: rgba(102, 126, 234, 0.03);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 1rem;
}

.contact-column h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
}

.personal-contact-grid .form-group {
    margin-bottom: 0.5rem;
}

.personal-contact-grid .form-group:last-child {
    margin-bottom: 0;
}

/* Responsive for personal contact grid */
@media (max-width: 1024px) {
    .personal-contact-grid {
        grid-template-columns: 1fr 1fr;
    }
    .contact-column:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .personal-contact-grid {
        grid-template-columns: 1fr;
    }
    .contact-column {
        margin-bottom: 1rem;
    }
    .contact-column:last-child {
        margin-bottom: 0;
    }
}

/* Vehicle Information Grid */
.vehicle-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.vehicle-column {
    background: rgba(102, 126, 234, 0.03);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 1rem;
}

.vehicle-column h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
}

.vehicle-info-grid .form-group {
    margin-bottom: 0.5rem;
}

.vehicle-info-grid .form-group:last-child {
    margin-bottom: 0;
}

/* Responsive for vehicle info grid */
@media (max-width: 1024px) {
    .vehicle-info-grid {
        grid-template-columns: 1fr 1fr;
    }
    .vehicle-column:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .vehicle-info-grid {
        grid-template-columns: 1fr;
    }
    .vehicle-column {
        margin-bottom: 1rem;
    }
    .vehicle-column:last-child {
        margin-bottom: 0;
    }
}

/* Financial Information Grid */
.financial-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.financial-column {
    background: rgba(102, 126, 234, 0.03);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 1rem;
}

.financial-column h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
}

.financial-info-grid .form-group {
    margin-bottom: 0.5rem;
}

.financial-info-grid .form-group:last-child {
    margin-bottom: 0;
}

/* Dynamic Fields Styling */
.dynamic-fields-container {
    margin-bottom: 1rem;
    width: 100%;
}

.add-field-section {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.add-field-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.add-field-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

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

.add-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.add-text {
    font-size: 0.8rem;
}

.dynamic-field-group {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 0.5rem;
    animation: slideIn 0.3s ease;
}

.dynamic-field-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

.dynamic-field-group .field-name {
    flex: 2;
}

.dynamic-field-group .field-amount {
    flex: 1;
}

.dynamic-field-group .field-amount .locked-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.dynamic-field-group .field-amount .locked-input-container input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding-right: 35px;
}

/* Ensure perfect column alignment for both accessories and services */
.dynamic-field-group .field-name input,
.dynamic-field-group .field-amount input,
.dynamic-field-group .field-amount .locked-input-container input {
    box-sizing: border-box;
    width: 100%;
}

/* Add padding for remove buttons inside amount fields */
.dynamic-field-group .field-amount input {
    padding-right: 35px;
}

/* Ensure headers align perfectly with their columns */
.services-table-header .header-name,
.accessories-table-header .header-name {
    padding-left: 0.5rem;
}

.services-table-header .header-amount,
.accessories-table-header .header-amount {
    padding-left: 0.5rem;
}

/* Services Table Styling */
.services-table-header,
.accessories-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.8rem;
    color: #4a5568;
}

.header-name {
    text-align: left;
}

.header-amount {
    text-align: left;
}

.dynamic-field-group {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    animation: slideIn 0.3s ease;
    width: 100%;
}

.dynamic-field-group .form-group {
    margin-bottom: 0;
}

.dynamic-field-group .field-name {
    width: 100%;
}

.dynamic-field-group .field-amount {
    width: 100%;
    position: relative;
}

.dynamic-field-group .field-amount .remove-field-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.remove-field-btn {
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.remove-field-btn:hover {
    background: #c53030;
    transform: scale(1.1);
}

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

/* Responsive for financial info grid */
@media (max-width: 768px) {
    .financial-info-grid {
        grid-template-columns: 1fr;
    }
    .financial-column {
        margin-bottom: 1rem;
    }
    .financial-column:last-child {
        margin-bottom: 0;
    }
    
    .dynamic-field-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dynamic-field-group .remove-field-btn {
        align-self: flex-end;
        margin-top: 0.5rem;
    }
}

/* Tax Information Section */
.tax-info-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.tax-info-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
}

/* Tax Information specific styles */
.tax-field-container {
    text-align: center;
    max-width: 250px;
    margin: 0 auto;
}

.tax-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    text-align: center;
}

.tax-info-section .locked-input-container {
    max-width: 200px;
    margin: 0 auto;
}

.tax-info-section .locked-input-container input {
    text-align: center;
    font-weight: 600;
    color: #2d3748;
}

/* Down Payment Section */
.down-payment-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
}

/* Lien Fields Section */
.lien-fields {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    animation: slideDown 0.3s ease-out;
}

.lien-fields .form-group input[readonly] {
    background-color: rgba(102, 126, 234, 0.1);
    color: #4a5568;
    font-weight: 500;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.25rem;
}

.form-group label::after {
    content: ' *';
    color: #e53e3e;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-group input:required ~ label::after,
.form-group select:required ~ label::after {
    opacity: 1;
}

/* Alternative approach for required fields */
.form-group.required label::after {
    content: ' *';
    color: #e53e3e;
    opacity: 1;
}

/* Contract Template Buttons Styling */
.contract-template-buttons {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.3);
    position: relative;
}

.contract-template-buttons::before {
    content: '⚠️ REQUIRED';
    position: absolute;
    top: -10px;
    left: 20px;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 1;
}

.contract-template-buttons h2 {
    color: #2d3748;
    font-weight: 700;
    margin-top: 10px;
    text-align: center;
}

.template-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.template-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.template-btn.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

/* Warranty buttons reuse template-btn styles */

.template-state {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.template-code {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

.template-btn.selected .template-code {
    color: white;
}

/* Responsive for template buttons */
@media (max-width: 768px) {
    .template-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .template-btn {
        min-width: auto;
        width: 100%;
    }
}

/* Locked Fields Styling */
.locked-field {
    position: relative;
}

.locked-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.locked-input-container input {
    padding-right: 50px;
    background-color: rgba(102, 126, 234, 0.05);
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
    font-weight: 600;
}

.locked-input-container input:focus {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: #667eea;
}

.lock-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 2;
}

.lock-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.lock-btn.unlocked {
    background: rgba(56, 161, 105, 0.1);
}

.lock-btn.unlocked .lock-icon {
    color: #38a169;
}

.lock-icon {
    font-size: 1rem;
    transition: all 0.3s ease;
}

.locked-field.unlocked .locked-input-container input {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(102, 126, 234, 0.2);
    color: #2d3748;
    font-weight: normal;
}

.locked-field.unlocked .lock-btn .lock-icon {
    content: '🔓';
}

.form-group input,
.form-group select {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    color: #2d3748;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(255, 255, 255, 0.9);
}

.form-group input::placeholder {
    color: #a0aec0;
}

/* Remove automatic validation styling - only show errors on form submission */
.form-group input.error {
    border-color: #e53e3e;
    background: rgba(229, 62, 62, 0.05);
}

.form-group input.success {
    border-color: #38a169;
    background: rgba(56, 161, 105, 0.05);
}

/* Toggle section styles */
.toggle-section {
    width: 100%;
}

.toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.toggle-header h2::after {
    display: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.cobuyer-section,
.lien-section,
.tradein-section {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    animation: slideDown 0.3s ease-out;
}

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

/* Form actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1rem 0;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    margin-top: 0.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.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 ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #4a5568;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

/* Responsive form adjustments */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .form-section h2 {
        font-size: 1.1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Compact form for smaller screens */
@media (max-height: 800px) {
    .form-section {
        padding: 0.75rem;
    }
    
    .form-section h2 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .form-grid {
        gap: 0.5rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .form-group label {
        font-size: 0.75rem;
    }
    
    .contract-form {
        gap: 0.75rem;
    }
    
    .toggle-switch {
        width: 50px;
        height: 28px;
    }
    
    .toggle-slider:before {
        height: 20px;
        width: 20px;
        left: 4px;
        bottom: 4px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(22px);
    }
    
    .cobuyer-section,
    .lien-section,
    .tradein-section {
        padding: 0.75rem;
        margin-top: 0.75rem;
    }
}

/* Removed slideInUp animation to prevent blinking during updates */ 