/* Custom styles for Healthcare Annotation Assistant */

/* Protection du code source (limitée aux éléments non-content) */
button, .btn, .navbar-brand, .nav-link {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Permettre la sélection de texte partout ailleurs par défaut */
* {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* General styling */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    scroll-behavior: smooth;
}

main {
    flex: 1 0 auto;
}

/* Improved typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* Feature icon styling */
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
}

/* Form styling */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid rgba(0,0,0,0.1);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    background-color: rgba(255,255,255,0.8);
}

.form-control:focus, .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.1);
    transform: translateY(-1px);
    background-color: rgba(255,255,255,1);
}

.btn {
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible {
    outline: 3px solid rgba(var(--bs-primary-rgb), 0.5);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--bs-primary), rgba(var(--bs-primary-rgb), 0.8));
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.9), var(--bs-primary));
}

.btn-secondary {
    background: linear-gradient(135deg, var(--bs-secondary), rgba(var(--bs-secondary-rgb), 0.8));
}

.btn-outline-primary {
    border: 1.5px solid var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

.btn-outline-primary:hover {
    background: var(--bs-primary);
    transform: translateY(-1px);
}

/* Card styling */
.card {
    transition: all 0.3s ease;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border-color: rgba(var(--bs-primary-rgb), 0.2);
}

.card-header {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.05), rgba(var(--bs-primary-rgb), 0.02));
    border-bottom: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px 12px 0 0 !important;
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Quill editor customization */
.ql-toolbar.ql-snow {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    background-color: rgba(33, 37, 41, 0.03);
    border-color: var(--bs-border-color);
}

.ql-container.ql-snow {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-color: var(--bs-border-color);
}

.ql-editor.ql-blank::before {
    color: var(--bs-secondary-color);
}

/* Navigation Enhancements */
.navbar {
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: all 0.2s ease;
    position: relative;
}

.navbar-nav .nav-link:hover {
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary) !important;
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.15), rgba(var(--bs-primary-rgb), 0.1));
    color: var(--bs-primary) !important;
    font-weight: 600;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--bs-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 80%;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    transition: transform 0.2s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

/* Dropdown menu enhancements */
.dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.dropdown-item:hover {
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    transform: translateX(4px);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 0.5rem;
    color: var(--bs-primary);
}

/* Responsive utilities */
@media (max-width: 767.98px) {
    .table-responsive {
        border: none;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem !important;
        margin: 0.1rem 0;
    }
    
    .dropdown-menu {
        margin-top: 0;
    }
}

/* Text contrast fixes */
.bg-light {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.bg-light p, .bg-light span, .bg-light div {
    color: #212529 !important;
}

/* Ensure text areas and form controls have proper contrast */
textarea, input[type="text"], input[type="email"], input[type="password"] {
    background-color: #fff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

textarea:focus, input:focus {
    background-color: #fff !important;
    color: #212529 !important;
}

/* Mobile textarea specific fix for visibility */
.mobile-textarea, #mobile-editor {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

.mobile-textarea:focus, #mobile-editor:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: var(--bs-primary) !important;
}

/* Dark theme specific overrides */
[data-bs-theme=dark] .bg-light {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

[data-bs-theme=dark] .bg-light p, 
[data-bs-theme=dark] .bg-light span, 
[data-bs-theme=dark] .bg-light div {
    color: #fff !important;
}

[data-bs-theme=dark] textarea, 
[data-bs-theme=dark] input[type="text"], 
[data-bs-theme=dark] input[type="email"], 
[data-bs-theme=dark] input[type="password"] {
    background-color: #343a40 !important;
    color: #fff !important;
    border: 1px solid #495057 !important;
}

/* Override dark theme for mobile textarea to ensure visibility */
[data-bs-theme=dark] .mobile-textarea, 
[data-bs-theme=dark] #mobile-editor {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

[data-bs-theme=dark] .mobile-textarea:focus, 
[data-bs-theme=dark] #mobile-editor:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: var(--bs-primary) !important;
}

[data-bs-theme=dark] .ql-snow .ql-stroke {
    stroke: var(--bs-body-color);
}

[data-bs-theme=dark] .ql-snow .ql-fill {
    fill: var(--bs-body-color);
}

[data-bs-theme=dark] .ql-toolbar.ql-snow {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme=dark] .ql-editor.ql-blank::before {
    color: rgba(255, 255, 255, 0.5);
}

/* Document type badge colors */
[data-bs-theme=dark] .badge.bg-primary {
    background-color: var(--bs-primary) !important;
}

[data-bs-theme=dark] .badge.bg-success {
    background-color: var(--bs-success) !important;
}

[data-bs-theme=dark] .badge.bg-info {
    background-color: var(--bs-info) !important;
}

[data-bs-theme=dark] .badge.bg-warning {
    background-color: var(--bs-warning) !important;
    color: var(--bs-dark);
}

/* Animation for loading states */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.animation-pulse {
    animation: pulse 2s infinite;
}

/* Custom styles for the language selector */
.language-flag {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.5em;
}

/* Mobile contrast fixes for white background elements */
@media (max-width: 768px) {
    /* Ensure text visibility on white backgrounds */
    .bg-white, .card, .modal-content, .list-group-item, .offcanvas-body, .navbar .dropdown-menu {
        background-color: #ffffff !important;
        color: #212529 !important;
    }
    
    .bg-white p, .bg-white span, .bg-white div, .bg-white label, .bg-white small,
    .card p, .card span, .card div, .card label, .card small,
    .modal-content p, .modal-content span, .modal-content div, .modal-content label, .modal-content small {
        color: #212529 !important;
    }
    
    /* Form controls mobile contrast */
    .form-control, textarea, input, .mobile-textarea, #mobile-editor {
        background-color: #ffffff !important;
        color: #212529 !important;
        border: 1px solid #ced4da !important;
    }
    
    .form-control::placeholder, textarea::placeholder, input::placeholder {
        color: #6c757d !important;
        opacity: 1 !important;
    }
    
    /* Dark theme counterparts for mobile */
    [data-bs-theme=dark] .bg-white, [data-bs-theme=dark] .card, 
    [data-bs-theme=dark] .modal-content, [data-bs-theme=dark] .list-group-item,
    [data-bs-theme=dark] .offcanvas-body, [data-bs-theme=dark] .navbar .dropdown-menu {
        background-color: #343a40 !important;
        color: #ffffff !important;
    }
    
    [data-bs-theme=dark] .bg-white p, [data-bs-theme=dark] .bg-white span, [data-bs-theme=dark] .bg-white div,
    [data-bs-theme=dark] .card p, [data-bs-theme=dark] .card span, [data-bs-theme=dark] .card div,
    [data-bs-theme=dark] .modal-content p, [data-bs-theme=dark] .modal-content span, [data-bs-theme=dark] .modal-content div {
        color: #ffffff !important;
    }
    
    [data-bs-theme=dark] .form-control, [data-bs-theme=dark] textarea, 
    [data-bs-theme=dark] input, [data-bs-theme=dark] .mobile-textarea, 
    [data-bs-theme=dark] #mobile-editor {
        background-color: #343a40 !important;
        color: #ffffff !important;
        border: 1px solid #495057 !important;
    }
}
