/* Modern Staff Application Form Styles */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --info-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Styles */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

/* Header Styling */
.site-navbar {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-bottom: 2rem;
}

.site-navbar h1 {
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin: 0;
    font-size: 2.5rem;
}

/* Main Card Styling */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 2rem;
    background: white;
    animation: fadeInUp 0.6s ease-out;
    transition: var(--transition-smooth);
}

.card.h-100 {
    height: 100%;
}

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

.card-header {
    background: var(--primary-gradient);
    color: white;
    padding: 1.5rem;
    border: none;
}

.card-header h4,
.card-header h5 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: white;
}

.card-body {
    padding: 2rem;
}

.card-body.bg-light {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
}

/* Form Controls */
.form-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control,
.form-select {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: var(--transition-smooth);
    font-size: 1rem;
}

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

.form-control:hover,
.form-select:hover {
    border-color: #cbd5e0;
}

/* Select2 Styling */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    min-height: 48px !important;
    padding: 0.5rem !important;
    transition: var(--transition-smooth);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px !important;
    padding-left: 0.5rem !important;
    color: #4a5568;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px !important;
}

.select2-dropdown {
    border: 2px solid #667eea !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

.select2-results__option--highlighted {
    background: var(--primary-gradient) !important;
}

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-success {
    background: var(--success-gradient);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

/* Button Ripple Effect */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Fieldset Styling */
fieldset {
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    margin-bottom: 2rem;
    background: white;
    transition: var(--transition-smooth);
}

fieldset:hover {
    border-color: #667eea !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

fieldset legend {
    background: var(--primary-gradient);
    color: white;
    padding: 0.5rem 1.5rem !important;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* Alert Styling */
.alert {
    border: none;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 5px solid #f59e0b;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 5px solid #ef4444;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 5px solid #3b82f6;
}

/* Side-by-side Layout Enhancement - Only for select roles page */
.select-roles-container .row > [class*='col-'] .card {
    margin-bottom: 0;
}

.select-roles-container .row > [class*='col-'] {
    margin-bottom: 1.5rem;
}

/* Dynamic Form Container - Full Width Layout */
.dynamic-form-container .card {
    margin-bottom: 2rem;
}

.dynamic-form-container .card-body {
    padding: 2rem;
}

.dynamic-form-container .col-lg-12 {
    margin-bottom: 0;
}

/* Ensure dynamic form doesn't inherit side-by-side styles */
.dynamic-form-container .row {
    margin-left: 0;
    margin-right: 0;
}

.dynamic-form-container fieldset {
    margin-bottom: 2rem;
    width: 100%;
}

/* Full width for specific sections */
.dynamic-form-container fieldset[data*="reference"],
.dynamic-form-container fieldset[data*="dbs"],
.dynamic-form-container fieldset[data*="emergency"] {
    width: 100%;
}

/* Better spacing for form fields */
.dynamic-form-container .mb-3 {
    margin-bottom: 1.5rem !important;
}

/* Ensure proper column spacing */
.dynamic-form-container .col-lg-6 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* File upload styling */
.dynamic-form-container input[type="file"] {
    padding: 1rem;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    width: 100%;
    cursor: pointer;
    background: #f8fafc;
    transition: var(--transition-smooth);
}

.dynamic-form-container input[type="file"]:hover {
    border-color: #667eea;
    background: white;
}

/* Better list styling in labels */
.dynamic-form-container .form-label ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.dynamic-form-container .form-label li {
    margin-bottom: 0.25rem;
}

/* Image display styling */
.dynamic-form-container img {
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
    border: 2px solid #e2e8f0;
}

/* Improve row spacing within fieldsets */
.dynamic-form-container fieldset > .row {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

.dynamic-form-container fieldset > .row > [class*='col-'] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Reference Info Section - Enhanced Styling */
.dynamic-form-container fieldset[data*="reference"] {
    background: white;
    border: 2px solid #e2e8f0 !important;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 2rem !important;
    margin-bottom: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Make reference section full width - override col-lg-6 */
.dynamic-form-container fieldset[data*="reference"] .col-lg-6 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

.dynamic-form-container fieldset[data*="reference"]:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.dynamic-form-container fieldset[data*="reference"] legend {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1.5rem !important;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-bottom: 1.5rem;
}

/* Reference Input Groups - Side by Side Layout */
.dynamic-form-container #referenceInputs {
    width: 100%;
    display: flex !important;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

.dynamic-form-container #referenceInputs .input-group {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex: 1 1 0;
    min-width: 0;
}

.dynamic-form-container #referenceInputs .input-group:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

/* Reference badge labels */
.dynamic-form-container #referenceInputs .input-group:nth-of-type(1):before {
    content: "First Reference";
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.dynamic-form-container #referenceInputs .input-group:nth-of-type(2):before {
    content: "Second Reference";
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Stack inputs vertically inside each card - Override Bootstrap input-group */
.dynamic-form-container #referenceInputs .input-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem;
}

.dynamic-form-container #referenceInputs .input-group .form-control {
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    width: 100% !important;
}

.dynamic-form-container #referenceInputs .input-group .form-control:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
    background: white;
    outline: none;
    z-index: 2;
}

.dynamic-form-container #referenceInputs .input-group .form-control::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

/* Responsive: Stack reference cards on tablets/mobile */
@media (max-width: 992px) {
    .dynamic-form-container #referenceInputs {
        flex-direction: column;
    }
    
    .dynamic-form-container #referenceInputs .input-group {
        min-width: 100%;
    }
}

/* Checkbox & Radio Styling */
.form-check-input {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #cbd5e0;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-check-label {
    cursor: pointer;
    color: #4a5568;
    margin-left: 0.5rem;
}

/* Modern Radio Button Groups - Override inline styles */
.dynamic-form-container div[style*="border"][style*="gray"] {
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    margin-top: 1rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dynamic-form-container div[style*="border"][style*="gray"]:hover {
    border-color: #667eea !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* Radio button group label */
.dynamic-form-container div[style*="border"][style*="gray"] > label.form-check-label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 1rem;
    margin-left: 0;
}

/* Button group for radio options */
.dynamic-form-container .btn-group {
    display: flex !important;
    gap: 1rem;
    margin-top: 0.5rem;
}

.dynamic-form-container .btn-group .btn {
    flex: 1;
    background: #f8fafc !important;
    border: 2px solid #e2e8f0 !important;
    color: #4a5568 !important;
    border-radius: 10px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.dynamic-form-container .btn-group .btn:hover {
    border-color: #667eea !important;
    background: #f0f4ff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* When radio is checked, style the parent button */
.dynamic-form-container .btn-group .btn:has(input:checked) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.dynamic-form-container .btn-group .btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 2;
}

.dynamic-form-container .btn-group .btn label {
    margin: 0;
    cursor: pointer;
    color: inherit !important;
    pointer-events: none;
}

/* Collapse Animation */
.collapse {
    border-radius: 10px;
    margin-top: 1rem;
}

.collapse.bg-light {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    padding: 1.5rem !important;
}

/* Better collapse row spacing */
.collapse > .row {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

/* Text Danger */
small.text-danger,
.text-danger {
    color: #dc2626 !important;
    font-weight: 700;
}

/* Footer */
footer {
    background: var(--primary-gradient);
    color: white;
    padding: 1.5rem;
    text-align: center;
    margin-top: 3rem;
    box-shadow: 0 -4px 15px rgba(102, 126, 234, 0.2);
}

footer a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-smooth);
}

footer a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

/* Error List Styling */
.list-group-item {
    border: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.list-group-item.bg-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    color: #991b1b;
    font-weight: 600;
}

/* File Upload Styling */
input[type="file"] {
    padding: 0.75rem;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    transition: var(--transition-smooth);
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #667eea;
    background: #f7fafc;
}

/* Textarea Styling */
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Date Input Styling */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    cursor: pointer;
}

/* Required Field Indicator */
.form-label small.text-danger {
    font-size: 1.2em;
    margin-left: 0.25rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .site-navbar h1 {
        font-size: 1.75rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    fieldset {
        padding: 1rem !important;
    }
    
    /* Stack cards vertically on mobile - Only for select roles page */
    .select-roles-container .col-lg-4,
    .select-roles-container .col-lg-8 {
        margin-bottom: 1.5rem;
    }
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Form Validation Styling */
.form-control:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

.form-control:valid:not(:placeholder-shown) {
    border-color: #10b981;
}

/* Section Divider */
.section-divider {
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px;
    margin: 2rem 0;
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-left: 5px solid #667eea;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-box p {
    margin: 0;
    color: #4c51bf;
    font-weight: 500;
}

/* Icon Styling */
.form-icon {
    color: #667eea;
    margin-right: 0.5rem;
}

/* Progress Indicator */
.form-progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.form-progress-bar {
    height: 100%;
    background: var(--success-gradient);
    transition: width 0.5s ease;
}

/* Badge Styling */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary-gradient);
}

.badge-success {
    background: var(--success-gradient);
}

/* Multi-step Form Indicator */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.step {
    flex: 1;
    text-align: center;
    padding: 1rem;
    border-radius: 10px;
    background: #f1f5f9;
    margin: 0 0.5rem;
    transition: var(--transition-smooth);
}

.step.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.step.completed {
    background: var(--success-gradient);
    color: white;
}

/* Submit Button - Enhanced Styling */
.dynamic-form-container #submitButton {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.dynamic-form-container #submitButton:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}

.dynamic-form-container #submitButton:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

/* Alert Warning - Confidentiality Notice */
.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 2rem;
}

/* Footer - Modern Styling */
footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 1.5rem !important;
    text-align: center !important;
    box-shadow: 0 -4px 15px rgba(102, 126, 234, 0.2);
    margin-top: 3rem;
    position: relative;
}

footer a {
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

footer a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

/* Signature Section - Match Child Form */
.dynamic-form-container .drawing-board {
    padding: 0;
}

.dynamic-form-container #drawing-board {
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    width: 100%;
    height: 200px;
    cursor: crosshair;
    background: white;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dynamic-form-container #drawing-board:hover {
    border-color: #667eea;
}

.dynamic-form-container #clear-button {
    margin-top: 1rem;
    width: 100%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    cursor: pointer;
}

.dynamic-form-container #clear-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.dynamic-form-container #clear-button:active {
    transform: translateY(0);
}
