/* Modernized styles for Brightspace LTI Course Request Tool */

:root {
    --primary-color: #0057b8;    /* Hanze blue - primary color used throughout the site */
    --primary-hover: #004795;    /* Darker blue for hover states */
    --secondary-color: #e94e1b;  /* Hanze orange */
    --secondary-hover: #d23c09;  /* Darker orange for hover states */
    --success-color: #28a745;    /* Green for success states */
    --danger-color: #dc3545;     /* Red for error/danger states */
    --warning-color: #ffc107;    /* Yellow for warnings */
    --info-color: #17a2b8;       /* Blue for info states */
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --dark-gray: #5a5a5a;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease-in-out;
    --border-radius: 0.375rem;
    --form-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --form-shadow-focus: 0 4px 12px rgba(0, 87, 184, 0.15);
}

/* Global Admin Template Harmonization */
/* Override old admin template styling to match main dashboard */

/* Remove all shadow classes - use modern subtle shadows */
.card.shadow {
    box-shadow: var(--box-shadow) !important;
}

/* Modernize old card headers */
.card-header.py-3 {
    background-color: var(--primary-color) !important;
    color: white !important;
    padding: 1rem !important;
}

.card-header h6.font-weight-bold {
    font-size: 1.25rem !important;
    font-weight: 500 !important;
    margin: 0 !important;
}

/* Fix table styling consistency */
.table-dark {
    background-color: transparent !important;
}

.table-dark th {
    background-color: var(--light-gray) !important;
    color: var(--dark-gray) !important;
    border-bottom: 2px solid var(--medium-gray) !important;
}

/* Ensure consistent button styling */
.btn-block {
    display: block;
    width: 100%;
}

/* Override old border-left styling */
.border-left-primary,
.border-left-success,
.border-left-info,
.border-left-warning,
.border-left-danger {
    border-left: none !important;
    border-radius: var(--border-radius) !important;
}

/* Force consistent card styling */
.card {
    border: none !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--box-shadow) !important;
    margin-bottom: 1.5rem !important;
}

/* Consistent table styling */
.table-bordered {
    border: 1px solid var(--medium-gray) !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    background-color: #f8f9fa;
    line-height: 1.5;
}

/* Special styles for iframe mode */
body.iframe-mode {
    background-color: transparent;
    margin: 0;
    padding: 0;
}

/* Sticky navbar - safe for all functionality */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1030; /* High enough to stay above other elements but below modals */
    transition: all 0.3s ease;
}

/* Ensure navbar doesn't interfere with dropdowns */
.navbar .dropdown-menu {
    z-index: 1031; /* Higher than navbar */
}

/* Ensure navbar doesn't interfere with modals */
.modal {
    z-index: 1050; /* Higher than navbar */
}

/* Ensure navbar doesn't interfere with tooltips */
.tooltip {
    z-index: 1070; /* Higher than navbar */
}

/* Ensure navbar doesn't interfere with popovers */
.popover {
    z-index: 1060; /* Higher than navbar */
}

/* Add some padding to body to account for sticky navbar */
body {
    padding-top: 0; /* No extra padding needed since navbar is sticky */
}

/* Special handling for iframe mode - no sticky navbar */
body.iframe-mode .navbar {
    position: relative;
    top: auto;
    padding: 0.2rem 0.5rem;
}

body.iframe-mode .container {
    width: 100%;
    max-width: 100%;
    padding-left: 5px;
    padding-right: 5px;
}

body.iframe-mode .content {
    padding: 8px;
}

body.iframe-mode .hide-in-iframe {
    display: none !important;
}

/* Modern card styling */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--medium-gray);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

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

.card-header.bg-secondary {
    background-color: var(--secondary-color) !important;
    color: white;
}

/* Course cart specific styling */
.card-header.bg-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #c73509 100%) !important;
}

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

.card-body {
    padding: 1.5rem;
}

/* Modern button styling */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

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

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

/* Add icons to buttons */
.btn i, .btn .fas, .btn .far, .btn .fab, .btn .fal {
    margin-right: 0.5rem;
}

/* Form styling - Updated for modern look */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.1);
    outline: none;
    transform: translateY(-1px);
}

.form-control:hover {
    border-color: var(--primary-color);
    background-color: #f8f9fa;
}

.form-label {
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* Improved table styling */
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td, .table th {
    padding: 1rem;
    border-bottom: 1px solid var(--medium-gray);
}

.table tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 87, 184, 0.05);
}

/* Modern table styling for admin sections */
.modern-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modern-table thead.table-primary th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    font-weight: 600;
    padding: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-table tbody tr {
    transition: all 0.2s ease;
    border: none;
}

.modern-table tbody tr:hover {
    background-color: rgba(0, 87, 184, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

/* Live counter animation */
#live-counter {
    animation: live-pulse 2s ease-in-out infinite;
}

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

#live-counter .fa-sync-alt {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Status badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

.badge-pending, .bg-pending {
    background-color: #f0ad4e;
    color: white;
}

.badge-approved, .bg-approved {
    background-color: var(--success-color);
    color: white;
}

.badge-rejected, .bg-rejected {
    background-color: var(--danger-color);
    color: white;
}

/* Enhanced iframe interactivity */
body.iframe-mode .form-check-input,
body.iframe-mode .btn,
body.iframe-mode button,
body.iframe-mode input,
body.iframe-mode select,
body.iframe-mode .form-control {
    cursor: pointer !important;
    position: relative !important;
    z-index: 100 !important;
}

/* Verbeterde focus states voor toegankelijkheid */
.btn:focus, 
button:focus, 
input:focus, 
select:focus, 
a:focus,
.form-check-input:focus {
    outline: 3px solid #0066CC !important;
    outline-offset: 2px !important;
    position: relative !important;
    z-index: 110 !important;
}

/* Modern alert styling */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.alert::before {
    margin-right: 0.75rem;
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 1.25rem;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.15);
    color: var(--success-color);
}

.alert-success::before {
    content: "\f058"; /* check-circle icon */
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--danger-color);
}

.alert-danger::before {
    content: "\f057"; /* times-circle icon */
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #856404;
}

.alert-warning::before {
    content: "\f071"; /* exclamation-triangle icon */
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.15);
    color: #0c5460;
}

.alert-info::before {
    content: "\f05a"; /* info-circle icon */
}

/* Make Flash Messages more modern */
.flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    max-width: 350px;
}

.flash-message {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    box-shadow: var(--box-shadow-lg);
    animation: slideIn 0.5s;
    display: flex;
    align-items: center;
}

@keyframes slideIn {
    from {transform: translateX(100%); opacity: 0;}
    to {transform: translateX(0); opacity: 1;}
}

/* Custom checkboxes */
.form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.125em;
    margin-right: 0.5rem;
}

.form-check-label {
    cursor: pointer;
}

/* Stats Cards */
.stats-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    transition: var(--transition);
}

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

.stats-card h3 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stats-card p {
    margin-bottom: 0;
    opacity: 0.8;
}

.stats-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1;
    color: white !important; /* Ensure text is white */
}

.stats-card h4 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: white !important; /* Ensure text is white */
}

/* Override any text-dark classes that might be applied */
.bg-warning .text-dark,
.bg-warning h4,
.bg-warning h2,
.bg-success .text-dark,
.bg-success h4,
.bg-success h2,
.bg-primary .text-dark,
.bg-primary h4,
.bg-primary h2 {
    color: white !important;
}

.bg-info {
    background-color: var(--info-color);
    color: white;
}

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

.bg-warning {
    background-color: var(--warning-color);
    color: white;
}

.bg-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Make "Totaal" text white since it's on blue background */
.bg-primary h4 {
    color: white;
}

/* Card header styling - ensure all headers match navbar color */
.card-header.bg-primary,
.card-header.bg-secondary {
    background-color: var(--primary-color) !important;
    color: white;
}

/* Custom select styling - Updated */
.form-select, .custom-select {
    position: relative;
    z-index: 10;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
    cursor: pointer;
}

.form-select:focus, .custom-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.1);
    outline: none;
    transform: translateY(-1px);
}

.form-select:hover, .custom-select:hover {
    border-color: var(--primary-color);
    background-color: #f8f9fa;
}

/* Force all select elements to be on top when focused */
select:focus {
    z-index: 1500 !important;
    position: relative;
}

/* Bootstrap specific dropdown fixes */
.form-select option {
    background: white;
    color: #333;
    padding: 0.5rem;
}

/* Loading indicator */
.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 0.25rem solid rgba(0, 87, 184, 0.25);
    border-right-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner 0.75s linear infinite;
}

@keyframes spinner {
    to {transform: rotate(360deg);}
}

/* Navbar styling */
.navbar-light .navbar-brand {
    color: var(--primary-color);
    font-weight: 600;
}

.navbar-light .nav-link {
    color: var(--dark-gray);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.navbar-light .nav-link:hover {
    background-color: rgba(0, 87, 184, 0.05);
    color: var(--primary-color);
}

.navbar-light .nav-link.active {
    background-color: rgba(0, 87, 184, 0.1);
    color: var(--primary-color);
}

/* Make all bg-primary and btn-primary use the same blue */
.bg-primary, .btn-primary, .card-header.bg-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

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

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

/* Make sure navbar bg matches primary color */
.navbar-dark.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Make stats cards consistent */
.stats-card.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Footer styling */
.footer {
    border-top: 1px solid var(--medium-gray);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Preview element */
.preview-code {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

/* Media queries for responsive design */
@media (max-width: 767.98px) {
    .card-body {
        padding: 1rem;
    }
    
    .table td, .table th {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
    }
    
    .flash-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* Modern Form Improvements */
.form-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: visible;
}

.form-row-modern {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--form-shadow);
    transition: var(--transition);
    position: relative;
    overflow: visible;
}

.form-row-modern:hover {
    box-shadow: var(--form-shadow-focus);
    transform: translateY(-1px);
}

/* Fix dropdown clipping issues */
.dropdown-container {
    position: relative;
    z-index: 1000;
    overflow: visible !important;
}

/* Higher z-index for later form rows to prevent clipping */
.form-row-modern:nth-child(3) .dropdown-container {
    z-index: 1100;
}

.form-row-modern:nth-child(4) .dropdown-container {
    z-index: 1200;
}

.form-row-modern:nth-child(5) .dropdown-container {
    z-index: 1300;
}

/* Specific fix for template dropdown */
#template_id {
    z-index: 1200 !important;
}

#template_id:focus, #template_id:active {
    z-index: 1500 !important;
}



/* Ensure dropdowns don't get clipped */
.row.mb-3 {
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

.col, .col-md-4, .col-md-6, .col-md-8 {
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

/* Additional fix for form containers */
.form-row-modern {
    position: relative;
    overflow: visible !important;
    z-index: auto;
}

/* Fix card overflow issues */
.card-body {
    overflow: visible !important;
    padding: 2rem;
}

.card {
    overflow: visible !important;
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Preview code styling - Enhanced for better visibility */
.preview-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 2rem;
    border: 2px solid var(--primary-color);
    position: relative;
    margin: 1.5rem 0;
    box-shadow: 0 8px 32px rgba(0, 87, 184, 0.15);
}

#preview_code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
    letter-spacing: 1.5px;
    text-align: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 8px;
    border: none;
    box-shadow: 0 6px 20px rgba(0, 87, 184, 0.25);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: preview-glow 3s ease-in-out infinite;
}

#preview_code:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 87, 184, 0.4);
}

/* Preview code glow animation */
@keyframes preview-glow {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(0, 87, 184, 0.25);
    }
    50% {
        box-shadow: 0 6px 20px rgba(0, 87, 184, 0.25), 
                    0 0 20px rgba(0, 87, 184, 0.3),
                    inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
}

/* Optional: Add a subtle typing effect when code changes */
#preview_code.updating {
    animation: preview-typing 0.5s ease-out;
}

@keyframes preview-typing {
    0% {
        transform: scale(0.98);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modern button styling */
.btn-modern {
    border-radius: 8px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-primary.btn-modern {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    box-shadow: 0 4px 15px rgba(0, 87, 184, 0.3);
}

.btn-primary.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 87, 184, 0.4);
}

/* Form validation feedback */
.form-feedback {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-left: 3px solid var(--danger-color);
}

.form-text {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .form-container {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .form-row-modern {
        padding: 1rem;
    }
    
    .form-label {
        font-size: 0.85rem;
    }
    
    .form-select, .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .btn-modern {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}
