/*
FleetTrak Instances Manager - Custom Styles
Main CSS stylesheet for the application
*/

/* Base styles */
:root {
    --accent-start: #3b82f6;
    --accent-middle: #6366f1;
    --accent-end: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-middle), var(--accent-end));
    --accent-gradient-horizontal: linear-gradient(90deg, var(--accent-start), var(--accent-middle), var(--accent-end));
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Main content area */
.main-content {
    flex: 1;
    padding: 20px 0;
}

/* Container adjustments */
.container {
    max-width: 1400px;
}

/* Card styling */
.card {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 15px 20px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    border-radius: 0 0 12px 12px !important;
    padding: 15px 20px;
    background: transparent;
}

/* Form styling */
.form-control,
.form-select {
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-start);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.form-label {
    margin-bottom: 8px;
    font-weight: 500;
}

/* Button styling */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-outline-light {
    color: #6c757d;
    border-color: #dee2e6;
}

.btn-outline-light:hover {
    color: #000;
    background: #f8f9fa;
    border-color: #dee2e6;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #dee2e6;
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-danger:hover {
    color: #fff;
    background: #dc3545;
    border-color: #dc3545;
}

.btn-group-sm > .btn {
    padding: 5px 10px;
    font-size: 0.875rem;
}

/* Table styling */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
    color: #495057;
    padding: 12px 15px;
}

.table td {
    border-top: 1px solid #dee2e6;
    padding: 12px 15px;
}

.table-hover tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Alert styling */
.alert {
    border-radius: 8px;
    border: none;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

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

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Badge styling */
.badge {
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Navbar styling */
.navbar {
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.navbar-nav .nav-link {
    margin-right: 15px;
}

.navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Footer styling */
.footer {
    margin-top: auto;
    padding: 20px 0;
}

/* Utility classes */
.text-secondary {
    color: #6c757d !important;
}

.text-primary {
    color: #212529 !important;
}

.bg-secondary {
    background: #f8f9fa !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-5 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .navbar-nav {
        margin-top: 10px;
    }
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

/* Input group styling */
.input-group-text {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.input-group .form-control {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

/* Code block styling */
code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875rem;
}

/* Hover effects for cards */
.card {
    cursor: default;
}

/* Form text styling */
.form-text {
    margin-top: 5px;
    font-size: 0.875rem;
}

/* Display classes */
.display-5 {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.lead {
    font-size: 1.1rem;
    font-weight: 400;
}

/* Custom checkbox and radio */
.form-check-input {
    border-radius: 4px;
}

.form-check-input:checked {
    background-color: var(--accent-start);
    border-color: var(--accent-start);
}

/* Loading spinner */
.spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 0.2em;
}

/* Tooltip styling */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    white-space: nowrap;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Custom dropdown */
.dropdown-menu {
    border-radius: 8px;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 8px 20px;
    border-radius: 6px;
    margin: 2px 10px;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #212529;
}

/* Modal styling */
.modal-content {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-radius: 12px 12px 0 0;
    padding: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-radius: 0 0 12px 12px;
    padding: 20px;
}

/* Close button for modals */
.btn-close-white {
    filter: brightness(0) invert(1);
}

/* Tab styling */
.nav-tabs {
    border-bottom: none;
    margin-bottom: 20px;
}

.nav-tabs .nav-link {
    border: none;
    padding: 12px 20px;
    background: transparent;
    color: #6c757d;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--accent-start);
    border-bottom-color: rgba(59, 130, 246, 0.3);
}

.nav-tabs .nav-link.active {
    color: var(--accent-start);
    border-bottom-color: var(--accent-start);
}

.tab-content {
    padding: 0;
}

/* Progress bar */
.progress {
    border-radius: 8px;
    height: 8px;
}

.progress-bar {
    border-radius: 8px;
    transition: width 0.6s ease;
}

/* List group */
.list-group-item {
    border-left: none;
    border-right: none;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* Custom utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.overflow-visible {
    overflow: visible !important;
}

/* Responsive table container */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--accent-start);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-start);
    color: white;
    padding: 8px 16px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* Dark mode specific adjustments */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #020617;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    
    .card {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    .form-control,
    .form-select {
        background: var(--bg-secondary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    
    .form-control::placeholder {
        color: var(--text-secondary);
    }
    
    .btn-outline-light {
        color: var(--text-primary);
        border-color: var(--border-color);
    }
    
    .btn-outline-light:hover {
        color: #fff;
        background: var(--accent-start);
        border-color: var(--accent-start);
    }
    
    .table {
        color: var(--text-primary);
    }
    
    .table th,
    .table td {
        border-color: var(--border-color);
    }
    
    .table th {
        background: var(--bg-secondary);
        color: var(--text-secondary);
    }
}

/* Light mode specific adjustments */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    .card {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    .form-control,
    .form-select {
        background: var(--bg-secondary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    
    .form-control::placeholder {
        color: var(--text-secondary);
    }
    
    .btn-outline-light {
        color: var(--text-primary);
        border-color: var(--border-color);
    }
    
    .btn-outline-light:hover {
        color: #fff;
        background: var(--text-primary);
        border-color: var(--text-primary);
    }
    
    .table {
        color: var(--text-primary);
    }
    
    .table th,
    .table td {
        border-color: var(--border-color);
    }
    
    .table th {
        background: var(--bg-secondary);
        color: var(--text-secondary);
    }
}

/* Selection styling */
::selection {
    background: rgba(59, 130, 246, 0.3);
    color: inherit;
}

/* Code block selection */
code::selection {
    background: rgba(59, 130, 246, 0.5);
}

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

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* Custom form validation */
.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 0.875rem;
}

/* Success validation */
.is-valid {
    border-color: #10b981;
}

/* Custom file input */
.form-control-file {
    display: none;
}

.custom-file-label {
    cursor: pointer;
}

.custom-file-label::after {
    content: "Parcourir";
}

/* Range slider styling */
.form-range {
    width: 100%;
}

/* Custom switch */
.form-switch .form-check-input {
    width: 2em;
    height: 1em;
    border-radius: 1em;
}

/* Grid layout utilities */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gap-3 {
    gap: 1rem;
}

.gap-4 {
    gap: 1.5rem;
}

/* Aspect ratio utilities */
.aspect-ratio-16-9 {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.aspect-ratio-16-9 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Z-index utilities */
.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.z-30 {
    z-index: 30;
}
