/* Auto Form Fill Service - Frontend Styles */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --success-hover: #15803d;
    --error-color: #dc2626;
    --error-hover: #b91c1c;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --border-color: #e2e8f0;
    --border-focus: #2563eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    font-size: 16px;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-lg);
}

.header-content {
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header h1 i {
    margin-right: 0.5rem;
    color: #93c5fd;
}

.header p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.status-indicator {
    display: inline-block;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.9rem;
}

.status.healthy {
    background-color: rgba(16, 163, 74, 0.2);
    color: #16a34a;
    border: 1px solid rgba(16, 163, 74, 0.3);
}

.status.error {
    background-color: rgba(220, 38, 38, 0.2);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    margin: 2rem 0;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-error {
    background-color: #fef2f2;
    border-left-color: var(--error-color);
    color: #991b1b;
}

.alert i {
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.alert strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* Main content */
.main-content {
    padding: 2rem 0;
}

.form-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.form-section {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-section h2 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Input groups */
.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.input-group label i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Form controls */
select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--bg-primary);
}

select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select:disabled, textarea:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Textarea container */
.textarea-container {
    position: relative;
}

.textarea-resize-hint {
    float: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 0.5rem;
}

.textarea-wrapper {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    background-color: var(--bg-primary);
}

.textarea-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: min-height 0.3s ease;
}

textarea.expanded {
    min-height: 400px;
}

.textarea-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 30%,
        var(--bg-tertiary) 30%,
        var(--bg-tertiary) 100%
    );
    border-top-left-radius: var(--border-radius);
}

.textarea-resize-handle:hover {
    color: var(--primary-color);
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 30%,
        var(--primary-color) 30%,
        var(--primary-color) 100%
    );
}

.textarea-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.textarea-actions-left,
.textarea-actions-right {
    display: flex;
    gap: 0.5rem;
}

.char-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.word-count {
    margin-left: 0.5rem;
}

/* Template Selection Container */
.template-selection-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .template-selection-container {
        grid-template-columns: 1fr 400px;
    }
}

.template-dropdown-section {
    display: flex;
    flex-direction: column;
}

/* Template info */
.template-info {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.template-info i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* PDF Preview Section */
.pdf-preview-section {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
    overflow: hidden;
}

.pdf-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.pdf-preview-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pdf-preview-header h4 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.pdf-preview-container {
    position: relative;
    height: 300px;
    background-color: var(--bg-secondary);
}

.pdf-preview-loading,
.pdf-preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pdf-preview-loading i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.pdf-preview-error i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--error-color);
}

#pdf-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.template-preview-info {
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
}

.template-preview-header h5 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.template-preview-header h5 i {
    margin-right: 0.5rem;
    color: var(--error-color);
}

.template-preview-description {
    margin-bottom: 1.5rem;
}

.template-preview-description p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.template-preview-fields {
    margin-bottom: 1.5rem;
}

.template-preview-fields h6 {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.template-preview-fields h6 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.template-preview-fields ul {
    margin: 0;
    padding-left: 1.25rem;
    list-style-type: disc;
}

.template-preview-fields li {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.template-preview-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-top: auto;
}

.template-preview-notice i {
    color: var(--primary-color);
    font-size: 0.875rem;
}

.template-preview-notice small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Options grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.option-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-item label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    background: none;
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Submit section */
.submit-section {
    text-align: center;
    margin-top: 2rem;
}

.submit-section .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Results section */
.results-section {
    padding: 2rem;
    background-color: var(--bg-secondary);
}

.results-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.results-section h3 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Progress bar */
.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, #3b82f6 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 6px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Processing details */
.processing-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.detail-item .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Results grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.result-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.result-content h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.result-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Download section */
.download-section {
    text-align: center;
}

.download-section .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Error container */
.error-container {
    text-align: center;
}

.error-container .alert {
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--text-primary) 0%, #1f2937 100%);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
    box-shadow: var(--shadow-lg);
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.footer-section {
    text-align: center;
}

.footer-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #f3f4f6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color) 0%, #3b82f6 100%);
    border-radius: 1px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section li {
    margin-bottom: 0.75rem;
    color: #d1d5db;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: var(--transition);
}

.footer-section li:hover {
    color: #f9fafb;
    transform: translateY(-1px);
}

.footer-section li:last-child {
    margin-bottom: 0;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1.5rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Responsive design */
@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-section {
        padding: 1.5rem;
    }
    
    .results-section {
        padding: 1.5rem;
    }
    
    .textarea-actions {
        flex-direction: column;
    }
    
    .processing-details {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 15px;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-bottom {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .results-section {
        padding: 1rem;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.pulse {
    animation: pulse 2s infinite;
}

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

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading .btn {
    cursor: wait;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
} 