﻿/* ========================================
   Enhanced Contract Form Styles
   ======================================== */

/* Container & Layout */
.enhanced-contract-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    min-height: 100vh;
}

/* Enhanced Loader */
.enhanced-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e3f2fd;
    border-top: 4px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loader-text {
    font-size: 1.1rem;
    color: #2196f3;
    font-weight: 500;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Progress Header */
.contract-progress-header {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

    .contract-progress-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, #2196f3 0%, #21cbf3 50%, #2196f3 100%);
        background-size: 200% 100%;
        animation: gradientMove 3s ease-in-out infinite;
    }

@keyframes gradientMove {
    0%, 100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.progress-steps {
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

    .step:not(:last-child)::after {
        content: '';
        position: absolute;
        right: -1.375rem;
        top: 50%;
        transform: translateY(-50%);
        width: 2rem;
        height: 2px;
        background: #e9ecef;
        transition: background 0.3s ease;
    }

    .step.completed::after {
        background: #28a745;
    }

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    background: white;
    color: #6c757d;
}

.step.active .step-icon {
    background: #2196f3;
    border-color: #2196f3;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.step.completed .step-icon {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    transition: color 0.3s ease;
}

.step.active .step-label {
    color: #2196f3;
    font-weight: 600;
}

.step.completed .step-label {
    color: #28a745;
}

/* Enhanced Form */
.enhanced-contract-form {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.form-step {
    padding: 3rem;
}

.step-header {
    margin-bottom: 2.5rem;
    text-align: center;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 1.5rem;
}

    .step-header h3 {
        margin: 0 0 0.5rem 0;
        color: #2c3e50;
        font-size: 1.5rem;
        font-weight: 600;
    }

    .step-header p {
        margin: 0;
        color: #6c757d;
        font-size: 1rem;
    }

/* Form Sections */
.form-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

/* Enhanced Labels */
.enhanced-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
    font-size: 0.875rem;
}

    .enhanced-label.required::after {
        content: '*';
        color: #dc3545;
        margin-left: 4px;
        font-weight: 700;
    }

/* Enhanced Inputs */
.enhanced-input {
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: white;
    color: #495057;
}

    .enhanced-input:focus {
        outline: none;
        border-color: #2196f3;
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
        transform: translateY(-1px);
    }

    .enhanced-input:hover:not(:focus) {
        border-color: #ced4da;
    }

    .enhanced-input.text-center {
        text-align: center;
        font-weight: 600;
    }

/* Enhanced Select */
.enhanced-select {
    position: relative;
}

    .enhanced-select .enhanced-input {
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' 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 12px center;
        background-size: 16px;
        padding-right: 40px;
    }

/* Enhanced Textarea */
.enhanced-textarea {
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: white;
    color: #495057;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

    .enhanced-textarea:focus {
        outline: none;
        border-color: #2196f3;
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    }

/* Field Hints */
.field-hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

/* Input with Spinner */
.input-with-spinner {
    display: flex;
    align-items: center;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

    .input-with-spinner:focus-within {
        border-color: #2196f3;
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    }

.spinner-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

    .spinner-btn:hover {
        background: #e9ecef;
        color: #495057;
    }

    .spinner-btn:active {
        background: #dee2e6;
    }

.input-with-spinner input {
    border: none;
    flex: 1;
    padding: 0.875rem 0.5rem;
    font-weight: 600;
}

    .input-with-spinner input:focus {
        outline: none;
        box-shadow: none;
    }

/* Currency and Percentage Inputs */
.currency-input,
.percentage-input {
    position: relative;
    display: flex;
    align-items: center;
}

    .currency-input input,
    .percentage-input input {
        padding-right: 3rem;
    }

.currency-symbol,
.percentage-symbol {
    position: absolute;
    right: 1rem;
    color: #6c757d;
    font-weight: 500;
    pointer-events: none;
}

/* Enhanced Checkboxes */
.enhanced-checkbox {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    background: white;
    transition: all 0.3s ease;
    position: relative;
}

    .checkbox-label::before {
        content: '';
        width: 20px;
        height: 20px;
        border: 2px solid #e9ecef;
        border-radius: 4px;
        background: white;
        transition: all 0.3s ease;
        flex-shrink: 0;
        margin-top: 2px;
    }

.enhanced-checkbox:checked + .checkbox-label::before {
    background: #2196f3;
    border-color: #2196f3;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20,6 9,17 4,12'%3e%3c/polyline%3e%3c/svg%3e");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}

.enhanced-checkbox:checked + .checkbox-label {
    border-color: #2196f3;
    background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
}

.checkbox-label:hover {
    border-color: #ced4da;
    background: #f8f9fa;
}

.checkbox-content {
    flex: 1;
}

.checkbox-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.checkbox-description {
    font-size: 0.875rem;
    color: #6c757d;
    line-height: 1.4;
}

.checkbox-label.small {
    padding: 0.75rem;
    font-size: 0.875rem;
}

    .checkbox-label.small .checkbox-title {
        font-size: 0.875rem;
    }

/* Payment Options */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.payment-option {
    width: 100%;
}

/* Additional Services */
.additional-services {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.service-option {
    width: 100%;
}

/* Period Info Cards */
.period-info {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #e8f5e8 0%, #ffffff 100%);
    border-radius: 10px;
    border: 1px solid #d4edda;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #28a745;
    color: white;
    font-size: 1.1rem;
}

.info-content {
    display: flex;
    flex-direction: column;
}

.info-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
}

.info-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

/* Price Calculation */
.price-calculation {
    background: linear-gradient(135deg, #fff3e0 0%, #ffffff 100%);
    border: 1px solid #ffcc02;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.calculation-header {
    font-weight: 600;
    color: #e65100;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.calculation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.calc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

    .calc-item.subtotal {
        border-top: 1px solid #ffcc02;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
        font-weight: 600;
    }

    .calc-item.total {
        border-top: 2px solid #e65100;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
        font-weight: 700;
        font-size: 1.1rem;
        color: #e65100;
    }

.calc-label {
    color: #6c757d;
    font-size: 0.875rem;
}

.calc-value {
    font-weight: 600;
    color: #495057;
}

/* Installments & Emptying Config */
.installments-config,
.emptying-config {
    background: linear-gradient(135deg, #f3e5f5 0%, #ffffff 100%);
    border: 1px solid #e1bee7;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.emptying-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.summary-label {
    color: #6c757d;
}

.summary-value {
    font-weight: 600;
    color: #495057;
}

/* Step Actions */
.step-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 2px solid #f8f9fa;
    margin-top: 2rem;
}

    .step-actions.final {
        border-top-color: #28a745;
    }

/* Enhanced Buttons */
.enhanced-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

    .enhanced-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;
    }

    .enhanced-btn:hover::before {
        left: 100%;
    }

    .enhanced-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }

    .enhanced-btn:active {
        transform: translateY(0);
    }

    .enhanced-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none !important;
    }

    .enhanced-btn.btn-primary {
        background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
    }

    .enhanced-btn.btn-secondary {
        background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
    }

    .enhanced-btn.btn-success {
        background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    }

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* Review Section */
.contract-review {
    max-width: 100%;
}

.review-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.review-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

    .review-card.highlight {
        background: linear-gradient(135deg, #e8f5e8 0%, #ffffff 100%);
        border-color: #28a745;
        transform: scale(1.02);
    }

    .review-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    }

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2196f3;
    color: white;
    font-size: 1.25rem;
}

.review-card.highlight .card-icon {
    background: #28a745;
}

.card-content {
    flex: 1;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.card-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.review-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
}

    .review-section h4 {
        margin: 0 0 1rem 0;
        color: #2c3e50;
        font-size: 1.1rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f8f9fa;
    }

.review-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.detail-label {
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 500;
}

.detail-value {
    color: #495057;
    font-weight: 600;
    text-align: right;
}

/* Financial Section */
.review-section.financial {
    background: linear-gradient(135deg, #fff8e1 0%, #ffffff 100%);
    border-color: #ffcc02;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.financial-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

    .financial-item.total {
        background: linear-gradient(135deg, #e8f5e8 0%, #ffffff 100%);
        border-color: #28a745;
        font-weight: 700;
        font-size: 1.05rem;
    }

.financial-label {
    color: #6c757d;
    font-size: 0.875rem;
}

.financial-value {
    color: #495057;
    font-weight: 600;
}

.financial-item.total .financial-value {
    color: #28a745;
}

/* Notes Section */
.notes-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f8f9fa;
}

/* Enhanced Alerts */
.enhanced-alert {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

    .enhanced-alert.alert-error {
        background: linear-gradient(135deg, #f8d7da 0%, #ffffff 100%);
        border: 1px solid #f1aeb5;
        color: #721c24;
    }

.alert-icon {
    font-size: 1.25rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.alert-message {
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .alert-close:hover {
        opacity: 1;
    }

/* Animations */
.fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .enhanced-contract-container {
        padding: 1rem 0.5rem;
    }

    .contract-progress-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }

    .progress-steps {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }

    .step:not(:last-child)::after {
        display: none;
    }

    .form-step {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .calculation-grid,
    .financial-grid {
        grid-template-columns: 1fr;
    }

    .review-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .review-details {
        grid-template-columns: 1fr;
    }

    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .detail-value {
        text-align: left;
    }

    .period-info {
        flex-direction: column;
    }

    .step-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .enhanced-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .review-cards {
        grid-template-columns: 1fr;
    }

    .progress-steps {
        grid-template-columns: repeat(2, 1fr);
        display: grid;
    }
}
