/**
 * Custom styles for Tesla Options Calculator
 */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --sidebar-width: 280px;
    --header-height: 56px;
}

/* Dark theme variables */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2a2a2a;
    --border-color: #404040;
}

/* General Layout */
body {
    font-size: 0.875rem;
    background-color: #f5f5f5;
}

.feather {
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 20px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

@media (max-width: 767.98px) {
    .sidebar {
        position: relative;
        top: 0;
    }
}

.sidebar-sticky {
    position: sticky;
    top: 0;
    height: calc(100vh - var(--header-height));
    padding-top: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.5rem 1rem;
    margin: 0.25rem 0;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.15);
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Navbar */
.navbar-brand {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.navbar .navbar-toggler {
    top: 0.25rem;
    right: 1rem;
}

/* Main content */
main {
    padding-top: 20px;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Tables */
.table {
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.dataTables_wrapper {
    padding: 0;
}

.dataTables_filter {
    text-align: right;
}

.dataTables_length select {
    width: auto;
    display: inline-block;
}

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

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.375rem;
    border-color: #ced4da;
}

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

/* Loading Spinner */
#loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.spinner-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.spinner-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    min-width: 250px;
}

.spinner-text {
    margin-top: 1rem;
    font-weight: 500;
    color: #666;
}

/* Enhanced notifications */
.notification-toast {
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

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

/* Data freshness indicator */
#data-freshness {
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    background-color: rgba(0, 0, 0, 0.05);
}

#data-freshness.text-success {
    background-color: rgba(25, 135, 84, 0.1);
}

#data-freshness.text-warning {
    background-color: rgba(255, 193, 7, 0.1);
}

/* Record count */
#record-count {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Retry container */
#retry-container {
    animation: fadeIn 0.3s ease-out;
}

/* Charts */
canvas {
    max-height: 400px;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Progress bars */
.progress {
    height: 1.25rem;
    border-radius: 0.375rem;
    background-color: #e9ecef;
}

.progress-bar {
    font-weight: 600;
    font-size: 0.75rem;
}

/* Feature boxes */
.feature-box {
    text-align: center;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    background-color: white;
    height: 100%;
    transition: all 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.feature-box i {
    margin-bottom: 1rem;
}

/* Option cards in OTM pages */
.card.border-success {
    border-width: 2px !important;
}

.card.border-warning {
    border-width: 2px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        padding: 0;
    }
    
    main {
        margin-left: 0;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
    }
}

/* DataTables customization */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.5rem;
    margin-left: 0.125rem;
    border-radius: 0.25rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color);
    color: white !important;
    border: 1px solid var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-color);
    color: white !important;
    border: 1px solid var(--primary-color);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

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

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

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

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.transition-all {
    transition: all 0.3s ease;
}

/* Print styles */
@media print {
    .sidebar, .navbar, .btn, .form-control, .form-select {
        display: none !important;
    }
    
    main {
        margin: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}