/**
 * Bootstrap Theme Customizations
 * Custom Bootstrap variables and theme-specific styles
 */

/* Bootstrap Variable Overrides */
:root {
    /* Primary Colors */
    --bs-primary: #007bff;
    --bs-primary-rgb: 0, 123, 255;
    
    /* Secondary Colors */
    --bs-secondary: #6c757d;
    --bs-success: #28a745;
    --bs-info: #17a2b8;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #343a40;
    
    /* Background Colors */
    --bs-body-bg: var(--bg-color);
    --bs-body-color: var(--text-color);
    
    /* Border Radius */
    --bs-border-radius: 0.5rem;
    --bs-border-radius-sm: 0.25rem;
    --bs-border-radius-lg: 0.75rem;
    --bs-border-radius-xl: 1rem;
    
    /* Spacing */
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

/* Dark Theme Bootstrap Overrides */
[data-bs-theme="dark"] {
    --bs-body-bg: var(--bg-color);
    --bs-body-color: var(--text-color);
    --bs-primary: #4dabf7;
    --bs-primary-rgb: 77, 171, 247;
    --bs-secondary: #6c757d;
    --bs-light: #495057;
    --bs-dark: #f8f9fa;
}

/* Custom Bootstrap Components */

/* Enhanced Navbar */
.navbar-dark {
    background: var(--header-bg) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    margin: 0 0.25rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Enhanced Cards */
.card {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    border-radius: 0.5rem !important;
    font-size: 0.9rem;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Enhanced Buttons */
.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

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

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

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

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Enhanced Forms */
.form-control,
.form-select {
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
}

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

/* Enhanced Modals */
.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* Enhanced Offcanvas */
.offcanvas {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border-color);
}

/* Enhanced Tooltips */
.tooltip .tooltip-inner {
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
}

/* Enhanced Dropdowns */
.dropdown-menu {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dropdown-item {
    color: var(--text-color);
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--primary-color);
    color: white;
}

/* Enhanced Alerts */
.alert {
    border: 1px solid transparent;
    border-radius: 0.75rem;
}

.alert-primary {
    background: rgba(var(--primary-color-rgb), 0.1);
    border-color: rgba(var(--primary-color-rgb), 0.2);
    color: var(--primary-color);
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.2);
    color: #155724;
}

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

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2);
    color: #721c24;
}

/* Enhanced Badges */
.badge {
    font-weight: 500;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Enhanced Progress */
.progress {
    background: var(--bg-secondary);
    border-radius: 1rem;
    overflow: hidden;
    height: 8px !important;
    border-radius: 4px;
    background-color: rgba(var(--bs-secondary-rgb), 0.2);
}

.progress-bar {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-hover-color));
    transition: width 0.6s ease;
    border-radius: 4px;
}

/* Enhanced card interactions */
.hover-card {
    transition: all 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Card styling improvements */
.card {
    border-radius: 0.5rem !important;
    font-size: 0.9rem;
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
    border-bottom: none !important;
    font-weight: 600;
}

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

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

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

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

.card-body {
    border-radius: 0 0 0.5rem 0.5rem !important;
    font-size: 0.875rem;
    line-height: 1.5;
}

.card-title {
    font-size: 1rem !important;
    font-weight: 600;
    color: inherit;
}

/* Drag handle styling */
.btn[style*="cursor: move"] {
    transition: opacity 0.2s ease;
}

.btn[style*="cursor: move"]:hover {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Button group in card headers */
.card-header .btn-group .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.card-header .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.card-header .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.card-header .btn-check:checked + .btn-outline-light {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: white;
    color: white;
}

/* Text readability improvements */
.text-muted {
    color: var(--bs-secondary) !important;
    opacity: 0.8;
}

.small {
    font-size: 0.8rem !important;
}

/* GridStack sizing adjustments */
.grid-stack {
    margin: 0;
}

.grid-stack-item {
    min-height: 100px;
}

.grid-stack-item-content {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Stat values sizing */
.h4 {
    font-size: 1.25rem !important;
    font-weight: 700;
}

/* Progress bar container */
.progress {
    height: 8px !important;
    border-radius: 4px;
    background-color: rgba(var(--bs-secondary-rgb), 0.2);
}

.progress-bar {
    border-radius: 4px;
}

/* Badge improvements */
.badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Compact spacing */
.mb-3 {
    margin-bottom: 0.75rem !important;
}

.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

/* Button sizing */
.btn-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Nested card improvements */
.card .card {
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Responsive Design Enhancements */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 0.5rem;
        margin-top: 1rem;
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-hover-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
}

.shadow-custom {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-color), var(--bg-color)) padding-box,
                linear-gradient(45deg, var(--primary-color), var(--primary-hover-color)) border-box;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-in-up {
    animation: slideInUp 0.5s ease-out;
}

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
