@font-face {
    font-family: 'Nunito';
    src: url('../fonts/Nunito-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 200 1000;
    font-style: normal;
}

@font-face {
    font-family: 'Nunito';
    src: url('../fonts/Nunito-Italic-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 200 1000;
    font-style: italic;
}

/* HTML Editor Styling */
#htmlEditor, #manualHtmlEditor {
    font-family: 'Courier New', Monaco, Consolas, 'Lucida Console', monospace;
    font-size: 13px;
    line-height: 1.5;
    background-color: #282c34;
    color: #abb2bf;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    padding: 1rem;
    tab-size: 2;
}

/* HTML Editor Dark Theme Colors */
#htmlEditor:focus, #manualHtmlEditor:focus {
    outline: none;
    border-color: #8ed8f8;
    box-shadow: 0 0 0 0.2rem rgba(142, 216, 248, 0.25);
}

/* HTML Editor Scrollbar */
#htmlEditor::-webkit-scrollbar, #manualHtmlEditor::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#htmlEditor::-webkit-scrollbar-track, #manualHtmlEditor::-webkit-scrollbar-track {
    background: #1e2127;
}

#htmlEditor::-webkit-scrollbar-thumb, #manualHtmlEditor::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 4px;
}

#htmlEditor::-webkit-scrollbar-thumb:hover, #manualHtmlEditor::-webkit-scrollbar-thumb:hover {
    background: #5c6370;
}

/* Quill Editor Customization for TwoFeetUp Branding */
.ql-editor {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
    min-height: 300px;
}

.ql-editor.ql-blank::before {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-style: normal;
    color: #a0a0a0;
}

.ql-snow .ql-tooltip {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.ql-toolbar {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Quill container styling to match TwoFeetUp branding */
.ql-container.ql-snow {
    border: 1px solid #e0e0e0;
    border-radius: 0 0 0.375rem 0.375rem;
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.ql-toolbar.ql-snow {
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem 0.375rem 0 0;
    background-color: #f8f9fa;
}

/* Ensure Quill editor text uses correct font */
.ql-editor p, 
.ql-editor h1, 
.ql-editor h2, 
.ql-editor h3, 
.ql-editor h4, 
.ql-editor h5, 
.ql-editor h6,
.ql-editor li,
.ql-editor blockquote {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Apply TwoFeetUp colors to Quill toolbar buttons */
.ql-toolbar.ql-snow .ql-stroke {
    stroke: #414299;
}

.ql-toolbar.ql-snow .ql-fill {
    fill: #414299;
}

.ql-toolbar.ql-snow button:hover .ql-stroke {
    stroke: #8474b5;
}

.ql-toolbar.ql-snow button:hover .ql-fill {
    fill: #8474b5;
}

.ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: #8ed8f8;
}

.ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: #8ed8f8;
}

:root {
    --primary-dark: #414299;
    --primary: #8474b5;
    --primary-light: #7a7fbd;
    --accent: #8ed8f8;
    --background: #f8f9fa;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --white: #ffffff;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Custom Bootstrap overwrites */
.btn-primary {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(65, 66, 153, 0.3);
}

.btn-outline-primary {
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Brand-styled filter status button */
#statusFilterDropdown.btn-outline-secondary {
    color: var(--primary-dark);
    border-color: var(--primary-light);
    background-color: transparent;
}

#statusFilterDropdown.btn-outline-secondary:hover,
#statusFilterDropdown.btn-outline-secondary:focus,
#statusFilterDropdown.btn-outline-secondary:active,
#statusFilterDropdown.btn-outline-secondary.show {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--white);
}

.btn-secondary {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-secondary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-info {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--text-dark);
}

.btn-info:hover {
    background-color: #6bc8e6;
    border-color: #6bc8e6;
}

/* Login page styling */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    border: none;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(132, 116, 181, 0.25);
}

/* Dashboard styling */
.navbar-brand {
    font-weight: 700;
    color: var(--primary-dark) !important;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    height: 40px;
    margin-right: 10px;
}

.navbar {
    background: var(--white) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid var(--accent);
}

/* Navigation icon styling */
.nav-link i {
    color: var(--primary-dark) !important;
    transition: color 0.3s ease;
}

.nav-link:hover i {
    color: var(--accent) !important;
}

.dropdown-item i {
    color: var(--primary-light) !important;
    margin-right: 0.5rem;
}

.dashboard-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

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

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

.document-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: none;
    overflow: hidden;
}

.document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.document-card .card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border: none;
    padding: 1.5rem;
}

.document-card .card-header h5 {
    margin: 0;
    font-weight: 600;
}

.document-card .card-body {
    padding: 1.5rem;
}

.document-icon {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.document-icon i {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

/* Customize page styling */
.customize-container {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-top: 2rem;
    overflow: hidden;
}

.customize-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 1.5rem;
}

.customize-header h2 {
    margin: 0;
    font-weight: 600;
}

.split-view {
    display: flex;
    min-height: calc(100vh - 200px);
}

.form-section {
    flex: 0 0 33%;
    padding: 2rem;
    border-right: 1px solid #e9ecef;
    background: #fafbfc;
    overflow-y: auto;
    height: calc(100vh - 200px);
}

.preview-section {
    flex: 1;
    padding: 2rem;
    background: var(--white);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: block;
}

.form-group .form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-group .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(132, 116, 181, 0.15);
}

.progress-indicator {
    background: var(--white);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-dark), var(--accent));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.preview-content {
    background: var(--white);
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 2rem;
    min-height: 400px;
    overflow-y: auto;
    height: calc(100vh - 280px);
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.preview-content h1 {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
}

.preview-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.preview-content th,
.preview-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.preview-content th {
    background-color: var(--primary);
    color: white;
    font-weight: bold;
}

.preview-content tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Checkbox group styling */
.checkbox-group {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin: 0.5rem 0;
}

.checkbox-group .form-check {
    margin-bottom: 0.5rem;
    padding-left: 0;
}

.checkbox-group .form-check:last-child {
    margin-bottom: 0;
}

.checkbox-group .form-check-input {
    margin-right: 0.5rem;
    margin-top: 0.25rem;
}

.checkbox-group .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkbox-group .form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(132, 116, 181, 0.15);
}

.checkbox-group .form-check-label {
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    margin-left: 1.5rem;
}

.action-buttons {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 2rem;
}

.spinner-border {
    color: var(--primary);
}

/* Alert styling */
.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* Responsive design */
@media (max-width: 768px) {
    .split-view {
        flex-direction: column;
    }
    
    .form-section {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .login-card {
        margin: 1rem;
        padding: 2rem;
    }
    
    .dashboard-header {
        padding: 1.5rem 0;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Utility classes */
.text-primary-dark {
    color: var(--primary-dark) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-accent {
    color: var(--accent) !important;
}

.bg-primary-dark {
    background-color: var(--primary-dark) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-accent {
    background-color: var(--accent) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.shadow {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
}

.shadow-lg {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15) !important;
}

/* AI Chat Styling */
.ai-chat-messages {
    border-radius: 8px;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    margin-bottom: 0.5rem;
    max-width: 90%;
    word-wrap: break-word;
}

.ai-bubble {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: var(--white);
    margin-right: auto;
    border-bottom-left-radius: 6px;
}

.user-bubble {
    background: var(--accent);
    color: var(--text-dark);
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.ai-message, .user-message {
    display: flex;
    margin-bottom: 1rem;
}

.ai-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-bubble ul {
    font-size: 0.9rem;
    padding-left: 1.2rem;
}

.message-bubble li {
    margin-bottom: 0.25rem;
}

.ai-thinking {
    font-style: italic;
    opacity: 0.8;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    background: #e9ecef;
    border-radius: 18px;
    margin-bottom: 0.5rem;
}

.ai-thinking::after {
    content: '...';
    animation: thinking 1.5s infinite;
}

@keyframes thinking {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.ai-suggestions {
    background: rgba(142, 216, 248, 0.1);
    border-left: 4px solid var(--accent);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.ai-suggestions h6 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.ai-suggestions ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.ai-suggestions li {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

/* Template Creator specific styling */
.template-creator-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.editor-mode {
    transition: all 0.3s ease;
}

.btn-check:checked + .btn-outline-primary {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.form-builder-elements {
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 400px;
}

.template-variable-tag {
    display: inline-block;
    background: var(--accent);
    color: var(--text-dark);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 0.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-variable-tag:hover {
    background: var(--primary-light);
    color: var(--white);
}

/* Footer styling */
.footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--white);
}

.footer p {
    margin: 0;
    opacity: 0.9;
}

/* Compact Stats Widget */
.compact-stats-widget {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(142, 216, 248, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(5px);
    max-width: 280px;
    margin-left: auto;
}

.stat-mini {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    background: rgba(132, 116, 181, 0.05);
    margin-bottom: 0.3rem;
    transition: all 0.2s ease;
    min-height: 32px;
}

.stat-mini:last-child {
    margin-bottom: 0;
}

.stat-mini:hover {
    background: rgba(132, 116, 181, 0.1);
    transform: translateX(2px);
}

.stat-mini i {
    color: var(--primary-dark);
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.stat-mini span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.2;
}

/* Fix Templates button link color to brand light blue */
.stat-mini a.text-white {
    color: var(--accent) !important;
    text-decoration: none;
}

.stat-mini a.text-white:hover {
    color: #6bc8e6 !important;
}

/* Custom badge colors for document categories */
.badge.bg-secondary {
    background-color: #5cb85c !important;  /* Soft green for system documents */
    color: white;
}

/* Responsive adjustments for compact widget */
@media (max-width: 768px) {
    .compact-stats-widget {
        max-width: none;
        margin: 0;
        margin-top: 1rem;
    }
    
    .stat-mini {
        padding: 0.5rem;
        min-height: 36px;
    }
    
    .stat-mini span {
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .action-buttons,
    .form-section,
    .footer,
    .compact-stats-widget {
        display: none !important;
    }
    
    .preview-section {
        width: 100% !important;
        padding: 0 !important;
    }
    
    .preview-content {
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
}
