/* Real Estate Counteroffer Form Styles */
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Container and Layout */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e1e1;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Authentication Section */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.subtitle {
    color: #666;
    margin-bottom: 32px;
    font-size: 16px;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e1e1e1;
    padding: 16px 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    color: #666;
    font-size: 14px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-link {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #666;
}

.breadcrumb-current {
    color: #333;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

/* Forms Grid */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.form-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.form-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.form-card-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.form-card-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.form-status {
    background: #e8f5e8;
    color: #2d6a2d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.form-card-body {
    padding: 0 24px 24px;
}

.form-card-body p {
    color: #666;
    margin-bottom: 16px;
}

.feature-list {
    list-style: none;
    margin: 0;
}

.feature-list li {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.form-card-footer {
    padding: 0 24px 24px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}

.btn-outline:hover:not(:disabled) {
    background: #007bff;
    color: white;
}

/* Form Styles */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
}

.form-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.form-description {
    color: #666;
    font-size: 16px;
}

.counteroffer-form {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

/* Progress Indicator */
.progress-indicator {
    margin-bottom: 32px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e1e1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    color: #666;
    text-align: center;
    display: block;
}

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

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

.required {
    color: #dc3545;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

/* Select dropdown specific styling */
select.form-input {
    padding-right: 40px; /* Add space for dropdown arrow */
    background-position: right 16px center; /* Position arrow 16px from right edge */
}

.form-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-input.error {
    border-color: #dc3545;
}

.form-input.valid {
    border-color: #28a745;
}

/* Terms Container */
.terms-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    background: #fafafa;
}

.search-container {
    position: relative;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.available-terms {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    margin-bottom: 16px;
}

.term-option {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.term-option:last-child {
    border-bottom: none;
}

.term-option:hover {
    background: #f8f9fa;
}

.term-option.selected {
    background: #e3f2fd;
    color: #0d47a1;
}

.term-id {
    font-weight: 600;
    color: #007bff;
    font-size: 12px;
}

.term-template {
    flex: 1;
    margin-left: 12px;
    font-size: 14px;
}

.term-badge {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.selected-terms-container h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.selected-terms {
    min-height: 60px;
}

.empty-state {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.selected-term {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.selected-term-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.selected-term-id {
    font-weight: 600;
    color: #007bff;
}

.remove-term {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.selected-term-template {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.term-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.term-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.final-term {
    background: #e8f5e8;
    color: #2d6a2d;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
    margin-top: 32px;
}

/* Auto-save Indicator */
.autosave-indicator {
    text-align: center;
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.autosave-indicator.show {
    opacity: 1;
}

.autosave-text {
    color: #28a745;
    font-size: 14px;
}

/* Error Messages */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Error Section */
.error-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.error-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.error-card h2 {
    color: #dc3545;
    margin-bottom: 16px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    color: #28a745;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .user-info {
        align-self: flex-end;
    }

    .main-content {
        padding: 20px;
    }

    .counteroffer-form {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-actions {
        flex-direction: column;
    }

    .breadcrumb {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .auth-card,
    .error-card {
        padding: 24px;
    }

    .form-header h1 {
        font-size: 24px;
    }

    .modal-content {
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .header,
    .form-actions,
    .modal,
    .loading-container {
        display: none !important;
    }

    .counteroffer-form {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .btn {
        display: none;
    }
}

/* Focus Management for Accessibility */
.btn:focus,
.form-input:focus,
.search-input:focus,
.term-input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-input,
    .search-input,
    .term-input {
        border-width: 2px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Field hints */
.field-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* Time input group */
.time-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.time-input {
    flex: 1;
    max-width: 200px;
}

.am-pm-group {
    display: flex;
    gap: 1rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
}

.radio-label input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.radio-label:hover {
    color: #2563eb;
}

.radio-label input[type="radio"]:checked + span {
    color: #2563eb;
    font-weight: 600;
}

/* Date input styling */
input[type="date"],
input[type="time"] {
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Success Modal Enhancements */
.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    text-align: center;
}

.envelope-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid #e1e4e8;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e1e4e8;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #24292e;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #586069;
    font-weight: 500;
    word-break: break-all;
}

.status-sent {
    color: #28a745;
    font-weight: 600;
}

.status-created {
    color: #0366d6;
    font-weight: 600;
}

.status-delivered {
    color: #28a745;
    font-weight: 600;
}

.status-completed {
    color: #6f42c1;
    font-weight: 600;
}

/* Two Column Layout for Buyer/Seller Sections */
.two-column-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

@media (min-width: 992px) {
    .two-column-section {
        grid-template-columns: 1fr 1fr;
    }
}

.column-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e1e4e8;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

/* Optional Label Style */
.optional-label {
    color: #6c757d;
    font-weight: normal;
    font-size: 0.875rem;
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Custom Term Input */
.custom-term-input-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
}

.custom-term-input-container h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #24292e;
}

.custom-term-input-group {
    display: flex;
    gap: 0.5rem;
}

.custom-term-input-group input {
    flex: 1;
}

.custom-term-input-group .btn {
    flex-shrink: 0;
}

/* Attachments Section */
.attachments-container {
    display: grid;
    gap: 1rem;
}

.attachment-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.9375rem;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.75rem;
    margin-top: 0.25rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.checkbox-label span {
    flex: 1;
}

.attachment-text-input {
    margin-top: 0.75rem;
    margin-left: 1.875rem;
}

.attachment-with-input .field-hint {
    margin-left: 1.875rem;
    margin-top: 0.5rem;
}

/* Conditional Field Groups */
#buyer-counteroffer-number-group,
#other-offer-title-group {
    transition: opacity 0.3s ease;
}

/* Add/Remove Signer Buttons */
#add-buyer-signer2-btn,
#add-seller-signer2-btn {
    margin-top: 1rem;
    width: 100%;
}

#buyer-signer2-section,
#seller-signer2-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #dee2e6;
}

#remove-buyer-signer2-btn,
#remove-seller-signer2-btn {
    margin-top: 0.5rem;
    width: 100%;
}

