/**
 * Modern Forms CSS
 * Theme-aware styling for form elements
 * Supports both light and dark themes
 */

/* Modern Input Styling */
.modern-input,
.form-control.modern-input {
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
    background: #ffffff !important;
    color: #495057 !important;
    box-shadow: none !important;
    border-width: 1px !important;
    border-style: solid !important;
}

/* Override Bootstrap form-control completely */
.form-control.modern-input {
    border: 1px solid #ced4da !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #ced4da !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

/* Ensure no double borders */
input.modern-input,
input.form-control.modern-input {
    border: 1px solid #ced4da !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #ced4da !important;
    box-shadow: none !important;
    background: #ffffff !important;
    outline: none !important;
}

.modern-input:focus,
.form-control.modern-input:focus {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    background: #ffffff !important;
    outline: none !important;
    border-width: 1px !important;
    border-style: solid !important;
}

.modern-input:hover,
.form-control.modern-input:hover {
    border-color: #80bdff !important;
    border-width: 1px !important;
    border-style: solid !important;
}

.modern-input:disabled,
.modern-input[readonly],
.form-control.modern-input:disabled,
.form-control.modern-input[readonly] {
    background: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

/* Modern Label Styling */
.modern-label {
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.modern-label::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Modern Help Text */
.modern-help {
    font-size: 0.875rem;
    color: var(--text-secondary, #6c757d);
    line-height: 1.4;
    margin-top: 0.5rem;
}

.modern-help i {
    margin-right: 0.25rem;
    color: var(--info-color, #17a2b8);
}

/* Modern Button Styling */
.modern-btn {
    background: linear-gradient(135deg, var(--primary-color, #667eea) 0%, var(--primary-dark, #5a6fd8) 100%);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, var(--primary-dark, #5a6fd8) 0%, var(--primary-color, #667eea) 100%);
}

.modern-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modern-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Modern Quill Container */
.modern-quill-container {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    overflow: hidden;
    background: #ffffff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-shadow: none;
}

.modern-quill-container:hover {
    border-color: #80bdff;
}

.modern-quill-container:focus-within {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Quill Editor Styling */
.modern-quill-container .ql-editor {
    min-height: 150px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary, #2c3e50);
    background: var(--input-bg, #ffffff);
    padding: 1rem;
}

.modern-quill-container .ql-toolbar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid var(--border-color, #dee2e6);
    padding: 0.75rem 1rem;
}

.modern-quill-container .ql-toolbar .ql-stroke {
    stroke: var(--text-secondary, #6c757d);
}

.modern-quill-container .ql-toolbar .ql-fill {
    fill: var(--text-secondary, #6c757d);
}

.modern-quill-container .ql-toolbar button {
    border-radius: 0.25rem;
    margin: 0 0.125rem;
    transition: all 0.2s ease;
}

.modern-quill-container .ql-toolbar button:hover {
    background: var(--primary-color, #667eea);
    color: white;
}

.modern-quill-container .ql-toolbar button.ql-active {
    background: var(--primary-color, #667eea);
    color: white;
}

/* Form Group Spacing */
.form-group {
    margin-bottom: 1.5rem;
}

/* Error States */
.modern-input.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.modern-quill-container.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Dark Theme Support */
[data-theme="dark"] .modern-input,
[data-theme="dark"] .form-control.modern-input {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
    box-shadow: none !important;
}

/* Dark theme for standard form-control inputs */
[data-theme="dark"] .form-control {
    background: #2c3e50 !important;
    border: 1px solid #495057 !important;
    color: #ecf0f1 !important;
    box-shadow: none !important;
    border-width: 1px !important;
    border-style: solid !important;
    outline: none !important;
}

[data-theme="dark"] .form-control:focus {
    background: #2c3e50 !important;
    border: 1px solid #80bdff !important;
    color: #ecf0f1 !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    border-width: 1px !important;
    border-style: solid !important;
    outline: none !important;
}

[data-theme="dark"] .form-control:hover {
    border: 1px solid #80bdff !important;
    border-width: 1px !important;
    border-style: solid !important;
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background: #34495e !important;
    color: #bdc3c7 !important;
}

[data-theme="dark"] .modern-input:focus,
[data-theme="dark"] .form-control.modern-input:focus {
    background: #2c3e50 !important;
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

[data-theme="dark"] .modern-input:hover,
[data-theme="dark"] .form-control.modern-input:hover {
    border-color: #80bdff !important;
}

[data-theme="dark"] .modern-input:disabled,
[data-theme="dark"] .modern-input[readonly],
[data-theme="dark"] .form-control.modern-input:disabled,
[data-theme="dark"] .form-control.modern-input[readonly] {
    background: #34495e !important;
    color: #bdc3c7 !important;
}

[data-theme="dark"] .modern-label {
    color: #ecf0f1;
}

[data-theme="dark"] .modern-help {
    color: #bdc3c7;
}

[data-theme="dark"] .modern-quill-container {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    box-shadow: none !important;
}

/* Dark theme for select elements */
[data-theme="dark"] .selectric {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric .selectric-wrapper {
    background: #2c3e50 !important;
    border-color: #495057 !important;
}

[data-theme="dark"] .selectric .selectric-wrapper .selectric {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric .selectric-wrapper .selectric .label {
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric .selectric-wrapper .selectric .button {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
}

/* Dark theme for selectric dropdown options */
[data-theme="dark"] .selectric .selectric-dropdown {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    min-width: 200px !important;
    width: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll {
    background: #2c3e50 !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul {
    background: #2c3e50 !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
    min-width: 200px !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li {
    background: #2c3e50 !important;
    color: #ecf0f1 !important;
    border-bottom: 1px solid #495057 !important;
    width: 100% !important;
    min-width: 200px !important;
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li:hover {
    background: #34495e !important;
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li.selected {
    background: #80bdff !important;
    color: #ffffff !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li.highlighted {
    background: #80bdff !important;
    color: #ffffff !important;
}

[data-theme="dark"] .selectric.modern-input {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric.modern-input .selectric-wrapper {
    background: #2c3e50 !important;
    border-color: #495057 !important;
}

[data-theme="dark"] .selectric.modern-input .selectric-wrapper .selectric {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric.modern-input .selectric-wrapper .selectric .label {
    color: #ecf0f1 !important;
}

[data-theme="dark"] .selectric.modern-input .selectric-wrapper .selectric .button {
    background: #2c3e50 !important;
    border-color: #495057 !important;
    color: #ecf0f1 !important;
}

/* Additional dark theme fixes for selectric */
[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li a {
    color: #ecf0f1 !important;
    background: transparent !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li a:hover {
    color: #ecf0f1 !important;
    background: #34495e !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li.selected a {
    color: #ffffff !important;
    background: #80bdff !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll ul li.highlighted a {
    color: #ffffff !important;
    background: #80bdff !important;
}

/* Ensure dropdown is visible */
[data-theme="dark"] .selectric .selectric-dropdown {
    z-index: 9999 !important;
    display: block !important;
}

[data-theme="dark"] .selectric .selectric-dropdown .selectric-scroll {
    max-height: 200px !important;
    overflow-y: auto !important;
}

/* General selectric dropdown fixes for both themes */
.selectric .selectric-dropdown {
    z-index: 9999 !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    min-width: 200px !important;
    width: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.selectric .selectric-dropdown .selectric-scroll {
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
}

.selectric .selectric-dropdown .selectric-scroll ul {
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
    min-width: 200px !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li {
    padding: 8px 12px !important;
    border-bottom: 1px solid #e9ecef !important;
    width: 100% !important;
    min-width: 200px !important;
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li:last-child {
    border-bottom: none !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li a {
    display: block !important;
    padding: 0 !important;
    color: #495057 !important;
    text-decoration: none !important;
    width: 100% !important;
    min-width: 200px !important;
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word !important;
    line-height: 1.4 !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li:hover {
    background: #f8f9fa !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li.selected,
.selectric .selectric-dropdown .selectric-scroll ul li.highlighted {
    background: #007bff !important;
    color: #ffffff !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li.selected a,
.selectric .selectric-dropdown .selectric-scroll ul li.highlighted a {
    color: #ffffff !important;
}

/* Force dropdown visibility - override any conflicting styles */
.selectric .selectric-dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
}

.selectric .selectric-dropdown .selectric-scroll {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.selectric .selectric-dropdown .selectric-scroll ul {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    list-style: none !important;
    margin: 0 !important;
}

.selectric .selectric-dropdown .selectric-scroll ul li a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-decoration: none !important;
    outline: none !important;
}

[data-theme="dark"] .modern-quill-container:hover {
    border-color: #80bdff !important;
}

[data-theme="dark"] .modern-quill-container .ql-editor {
    background: var(--input-bg, #2c3e50);
    color: var(--text-primary, #ecf0f1);
}

[data-theme="dark"] .modern-quill-container .ql-toolbar {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    border-bottom-color: #34495e;
}

[data-theme="dark"] .modern-quill-container .ql-toolbar .ql-stroke {
    stroke: var(--text-secondary, #bdc3c7);
}

[data-theme="dark"] .modern-quill-container .ql-toolbar .ql-fill {
    fill: var(--text-secondary, #bdc3c7);
}

[data-theme="dark"] .modern-quill-container .ql-toolbar button:hover {
    background: var(--primary-color, #667eea);
    color: white;
}

[data-theme="dark"] .modern-quill-container .ql-toolbar button.ql-active {
    background: var(--primary-color, #667eea);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modern-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .modern-btn {
        width: 100%;
        padding: 1rem 2rem;
    }
    
    .modern-quill-container .ql-editor {
        min-height: 120px;
        padding: 0.75rem;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-input,
.modern-quill-container,
.modern-btn {
    animation: fadeIn 0.3s ease-out;
}

/* Focus ring for accessibility */
.modern-input:focus,
.modern-quill-container:focus-within,
.modern-btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modern-input {
        border-width: 3px;
    }
    
    .modern-quill-container {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modern-input,
    .modern-quill-container,
    .modern-btn {
        transition: none;
        animation: none;
    }
    
    .modern-btn:hover {
        transform: none;
    }
}

/* Modern Dropdown Styling */
.navbar-nav .dropdown-menu {
    border: none !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    padding: 0.5rem 0 !important;
    margin-top: 0.5rem !important;
    min-width: 200px !important;
    background: #ffffff !important;
    overflow: hidden !important;
}

.navbar-nav .dropdown-menu .dropdown-item {
    padding: 0.75rem 1.25rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

.navbar-nav .dropdown-menu .dropdown-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #5a6fd8 100%) !important;
    color: #ffffff !important;
    transform: none !important;
    box-shadow: none !important;
}

.navbar-nav .dropdown-menu .dropdown-item.active {
    background: linear-gradient(135deg, #667eea 0%, #5a6fd8 100%) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.navbar-nav .dropdown-menu .dropdown-item i {
    margin-right: 0.75rem !important;
    width: 16px !important;
    text-align: center !important;
}

/* Dark theme dropdown styling */
[data-theme="dark"] .navbar-nav .dropdown-menu {
    background: #2c3e50 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .navbar-nav .dropdown-menu .dropdown-item {
    color: #ecf0f1 !important;
}

[data-theme="dark"] .navbar-nav .dropdown-menu .dropdown-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #5a6fd8 100%) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .navbar-nav .dropdown-menu .dropdown-item.active {
    background: linear-gradient(135deg, #667eea 0%, #5a6fd8 100%) !important;
    color: #ffffff !important;
}

/* Fix for dropdown overflow issues */
.navbar-nav .dropdown-menu {
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.navbar-nav .dropdown-menu .dropdown-item {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Ensure dropdown stays within bounds */
.navbar-nav .dropdown {
    position: relative !important;
}

.navbar-nav .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    z-index: 1050 !important;
}
