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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Status Bar */
.status-bar {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Profile Section */
.profile-section {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
}

.profile-section .form-group {
    margin-bottom: 15px;
}

.profile-section label {
    color: white;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.profile-section select {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    color: #333;
    font-size: 16px;
    transition: all 0.3s ease;
}

.profile-section select:focus {
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
    outline: none;
}

.profile-note {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-note i {
    color: #fff;
    font-size: 16px;
}

/* SMS Opt-in Section */
.sms-optin-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
}

.optin-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 4px;
    accent-color: #667eea;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-group label {
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.6;
    flex: 1;
}

.checkbox-group label i {
    color: #667eea;
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-text {
    flex: 1;
    line-height: 1.6;
}

.checkbox-group label a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
    white-space: nowrap;
}

.checkbox-group label a:hover {
    color: #5a6fd8;
    text-decoration: none;
}

.optin-note {
    font-size: 0.9rem;
    color: #718096;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
    padding-left: 32px;
}

.optin-note i {
    color: #667eea;
    margin-top: 2px;
    flex-shrink: 0;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.api-status.connected {
    color: #28a745;
}

.api-status.disconnected {
    color: #dc3545;
}

.api-status.checking {
    color: #ffc107;
}

.api-status i {
    font-size: 0.8rem;
}

/* Tab Styles */
.tab-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.tab-nav {
    display: flex;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 20px;
    border: none;
    background: transparent;
    color: #718096;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    color: #667eea;
    background: white;
    border-bottom-color: #667eea;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.optional-intro {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.intro-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.intro-card i {
    color: #667eea;
    font-size: 2rem;
    margin-top: 5px;
    flex-shrink: 0;
}

.intro-text h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.intro-text p {
    color: #718096;
    line-height: 1.6;
    margin: 0;
}

/* Form Styles */
.lead-form {
    background: transparent;
}

.form-section {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2 i {
    color: #667eea;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    align-items: start;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

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

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

/* Generate Button */
.generate-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.form-group:has(.generate-btn) {
    position: relative;
}

.form-group:has(.generate-btn) input {
    padding-right: 100px;
}

.generate-btn:hover {
    background: #5a6fd8;
}

/* Transcript Styles */
.transcript-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.transcript-header h3 {
    color: #4a5568;
    font-size: 1.1rem;
}

.remove-transcript {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.remove-transcript:hover {
    background: #c53030;
}

.transcript-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

.btn-secondary:hover {
    background: #4a5568;
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c53030 0%, #9c2626 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

.add-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-btn:hover {
    background: #38a169;
    transform: translateY(-2px);
}

/* Submit Section */
.submit-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.loading-content i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 20px;
}

.loading-content p {
    font-size: 1.1rem;
    color: #4a5568;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #4a5568;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

.modal-body {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

#jsonPreview {
    background: #1a202c;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Result Styles */
.result-success {
    color: #28a745;
    background: #d4edda;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.result-error {
    color: #dc3545;
    background: #f8d7da;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
}

.result-success h4,
.result-error h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.workflow-id {
    font-family: 'Courier New', monospace;
    background: rgba(0,0,0,0.1);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 10px;
    word-break: break-all;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .tab-btn {
        padding: 15px 10px;
        font-size: 0.9rem;
    }

    .tab-btn i {
        font-size: 1rem;
    }

    .intro-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .intro-card i {
        align-self: center;
        margin-top: 0;
    }

    .sms-optin-section {
        padding: 15px;
    }

    .checkbox-group {
        gap: 12px;
    }

    .checkbox-group label {
        font-size: 0.95rem;
    }

    .checkbox-text {
        font-size: 0.95rem;
    }

    .optin-note {
        font-size: 0.85rem;
        padding-left: 30px;
    }

    .form-section {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .transcript-grid {
        grid-template-columns: 1fr;
    }

    .submit-section {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        margin: 10px;
        max-height: 90vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }

    .terms-section {
        padding: 25px;
    }

    .terms-section h2 {
        font-size: 1.2rem;
    }

    .terms-section h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .tab-nav {
        flex-direction: column;
    }

    .tab-btn {
        padding: 15px;
        border-bottom: none;
        border-right: 3px solid transparent;
    }

    .tab-btn.active {
        border-bottom: none;
        border-right-color: #667eea;
    }

    .intro-card {
        padding: 20px;
    }

    .intro-text h3 {
        font-size: 1.2rem;
    }

    .sms-optin-section {
        padding: 12px;
    }

    .checkbox-group {
        gap: 10px;
    }

    .checkbox-group input[type="checkbox"] {
        margin-top: 2px;
    }

    .checkbox-group label {
        font-size: 0.9rem;
    }

    .checkbox-text {
        font-size: 0.9rem;
    }

    .optin-note {
        padding-left: 0;
        font-size: 0.8rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .generate-btn {
        position: static;
        transform: none;
        margin-top: 10px;
        width: 100%;
    }

    .form-group:has(.generate-btn) input {
        padding-right: 12px;
    }

    .terms-section {
        padding: 20px;
    }

    .terms-section h2 {
        font-size: 1.1rem;
    }

    .terms-section h3 {
        font-size: 1rem;
    }
}

/* Animation Classes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Terms and Privacy Pages */
.terms-content {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.terms-section {
    padding: 40px;
    border-bottom: 1px solid #eee;
}

.terms-section:last-child {
    border-bottom: none;
}

.terms-section h2 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.terms-section h2 i {
    color: #667eea;
}

.terms-section h3 {
    color: #4a5568;
    margin: 25px 0 15px 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.terms-section h3 i {
    color: #667eea;
    font-size: 1rem;
}

.terms-section p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #4a5568;
}

.terms-section ul {
    margin: 15px 0;
    padding-left: 25px;
}

.terms-section li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #4a5568;
}

.terms-section strong {
    color: #2d3748;
    font-weight: 600;
}

.terms-section a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
}

.terms-section a:hover {
    color: #5a6fd8;
    text-decoration: none;
}

.back-link {
    text-align: center;
    padding: 20px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Auto Questions Section */
#autoQuestionsSection {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-left: 4px solid #f39c12;
}

#autoQuestionsSection h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

#autoQuestionsSection h3 {
    color: #34495e;
    margin: 20px 0 15px 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 8px;
}

.field-note {
    color: #7f8c8d;
    font-style: italic;
    margin-top: 5px;
    font-size: 0.9rem;
}

/* Additional Drivers Section */
.additional-driver-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
}

.driver-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.driver-header h4 {
    color: #495057;
    margin: 0;
    font-size: 1.1rem;
}

.remove-driver {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.remove-driver:hover {
    background: #c82333;
}

/* Incidents Section */
.incident-item {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
}

.incident-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1c40f;
}

.incident-header h4 {
    color: #856404;
    margin: 0;
    font-size: 1.1rem;
}

.remove-incident {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.remove-incident:hover {
    background: #c82333;
}

/* Add buttons for auto sections */
#autoQuestionsSection .add-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#autoQuestionsSection .add-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

#autoQuestionsSection .add-btn i {
    font-size: 0.9rem;
}
