/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    color: #334155;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Main content area - split into two equal panes */
.main-content {
    display: flex;
    flex: 1;
    height: 100%;
}

.form-panel {
    width: 50%;
    padding: 2rem;
    overflow-y: auto;
    border-right: 1px solid #e2e8f0;
}

.preview-panel {
    width: 50%;
    padding: 2rem;
    overflow-y: auto;
    background-color: #f8fafc;
    scroll-behavior: smooth;
    position: relative;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3b82f6;
}

.header h1 {
    color: #1e40af;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: #64748b;
    font-size: 0.9rem;
}

/* Tab navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    position: relative;
    scroll-behavior: smooth;
}

.tab-navigation::-webkit-scrollbar {
    display: none;
}

.tab-navigation::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(to right, transparent, white 50%);
    padding-left: 20px;
    color: #64748b;
    font-size: 18px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.tab-navigation.has-overflow::after {
    content: '→';
    opacity: 1;
}

.tab-overflow-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #3b82f6;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s;
    background: linear-gradient(to right, transparent, white 60%);
    padding-left: 15px;
    animation: pulse 2s infinite;
}

.tab-navigation.has-overflow .tab-overflow-indicator {
    opacity: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.tab-button {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-button:hover {
    color: #3b82f6;
    background-color: #f1f5f9;
}

.tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background-color: #f1f5f9;
}

/* Form sections */
.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    color: #1e40af;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Form groups */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox styles */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Navigation buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.nav-button {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.2rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-button:hover:not(.disabled) {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

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

.nav-button.primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.nav-button.primary:hover {
    background-color: #2563eb;
}

/* Preview styles */
.preview-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.preview-content h2 {
    color: #1e40af;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    text-align: center;
}

.document-preview {
    font-family: 'Times New Roman', serif;
    line-height: 1.6;
    color: #1f2937;
    white-space: pre-wrap;
    font-size: 10.5pt;
    scroll-behavior: smooth;
}

/* Copy protection for unpaid users */
.document-preview:not([style*="user-select: text"]) {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Highlighted text animation */
.highlighted-text {
    background-color: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
    animation: highlight 3s ease-out;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
    transition: all 0.3s ease;
}

@keyframes highlight {
    0% { 
        background-color: #fbbf24; 
        box-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
        transform: scale(1.02);
    }
    20% { 
        background-color: #fcd34d; 
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
        transform: scale(1.01);
    }
    100% { 
        background-color: #fef3c7; 
        box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
        transform: scale(1);
    }
}

/* Contextual Tips */
.contextual-tip {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    font-size: 0.875rem;
    line-height: 1.4;
}

.contextual-tip strong {
    color: #fbbf24;
}

.tip-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.tip-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Smart Help System */
.smart-help {
    position: fixed;
    bottom: 100px;
    right: 20px;
    max-width: 420px;
    z-index: 999;
    animation: slideInUp 0.5s ease-out;
}

.smart-help-content {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1.25rem 1.75rem;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.smart-help-content::before {
    content: '🎯';
    font-size: 1.5rem;
    position: absolute;
    top: -10px;
    left: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 6px 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.smart-help .help-close {
    position: absolute;
    top: 12px;
    right: 18px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: bold;
}

.smart-help .help-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Tooltip System */
.tooltip {
    pointer-events: none;
    z-index: 1001;
}

.tooltip-content {
    background: #1f2937;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 300px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    word-wrap: break-word;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid #1f2937;
}

/* Tooltip Container for Better UX */
.tooltip-container {
    position: relative;
}

.tooltip-container label {
    cursor: help;
    transition: all 0.2s ease;
    position: relative;
}

.tooltip-container label:hover {
    color: #3b82f6;
    transform: translateY(-1px);
}

/* Enhanced Form Labels with Icons */
.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    color: #374151;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.form-group label:hover {
    color: #1f2937;
}

/* Animation for Smart Help */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Floating Help Button */
.floating-help-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(30, 64, 175, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(30, 64, 175, 0.4);
}

.floating-help-btn:active {
    transform: scale(0.95);
}

/* Results tab specific styles */
.results-section {
    margin-bottom: 2rem;
}

.risk-card {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.risk-card.high {
    background-color: #fef2f2;
    border-left-color: #dc2626;
    color: #991b1b;
}

.risk-card.medium {
    background-color: #fffbeb;
    border-left-color: #d97706;
    color: #92400e;
}

.risk-card.low {
    background-color: #f0fdf4;
    border-left-color: #16a34a;
    color: #166534;
}

.risk-card h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.risk-card p {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Responsive design */
@media (max-width: 1024px) {
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .form-panel,
    .preview-panel {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .navigation-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .form-panel,
    .preview-panel {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .tab-navigation {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1;
        min-width: auto;
    }
}
/* Chat Popup Overlay */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.chat-popup {
    background: white;
    border-radius: 16px;
    width: 500px;
    max-width: 90vw;
    height: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popIn 0.3s ease-out;
}

.chat-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    border-radius: 16px 16px 0 0;
}

.chat-popup-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-popup-header p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chat-popup-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    padding: 0.75rem;
    border-radius: 12px;
    max-width: 85%;
}

.chat-message.user {
    background: #3b82f6;
    color: white;
    align-self: flex-end;
}

.chat-message.assistant {
    background: #f1f5f9;
    color: #334155;
    align-self: flex-start;
}

.chat-message.assistant strong {
    color: #1e40af;
}

.chat-loading {
    font-style: italic;
    color: #6b7280;
}

.chat-popup-input {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-popup-input textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 0.875rem;
    min-height: 42px;
    max-height: 100px;
}

.chat-popup-input textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-send-btn {
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
    background: #2563eb;
}

.chat-send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.chat-popup-footer {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
    text-align: center;
}

.consult-link {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.consult-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Mobile responsiveness for chat */
@media (max-width: 640px) {
    .contextual-tip {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .floating-help-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .chat-popup {
        width: 95vw;
        height: 90vh;
        margin: 20px;
    }
    
    .chat-popup-input {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .chat-send-btn {
        width: 100%;
    }
}

/* Small Paywall Popup Styles */
.paywall-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.paywall-popup {
    background: white;
    border-radius: 16px;
    width: 400px;
    max-width: 90vw;
    padding: 2rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popIn 0.3s ease-out;
    text-align: center;
}

.paywall-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
}

.paywall-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.paywall-popup h3 {
    margin: 0 0 0.5rem 0;
    color: #1e40af;
    font-size: 1.25rem;
}

.paywall-popup p {
    margin: 0 0 1.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.paywall-price {
    font-size: 2rem;
    font-weight: bold;
    color: #059669;
    margin: 1rem 0;
}

.paywall-divider {
    margin: 1.5rem 0 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.paywall-unlock {
    margin-bottom: 1.5rem;
}

.paypal-id-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 0.75rem;
}

.paypal-id-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.paypal-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

.unlock-btn {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.unlock-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.consult-small-btn {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}

.consult-small-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.skip-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.7;
}

.skip-btn:hover {
    opacity: 1;
}

/* Disable pointer events on copy/download buttons when not paid */
.nav-button.locked {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.nav-button.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .paywall-popup {
        width: 95vw;
        padding: 1.5rem;
    }
    
    .paywall-price {
        font-size: 1.75rem;
    }
}

/* Preview Notice Styles */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.preview-notice {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.2);
    white-space: nowrap;
}

@media (max-width: 1024px) {
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .preview-notice {
        align-self: flex-end;
    }
}

@media (max-width: 640px) {
    .preview-notice {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
}
