/* PlaneSales Shared Styles
 * Bootstrap 5.2 customizations and shared component styles
 */

/* ==========================================================================
   CSS Custom Properties (Variables)
   ========================================================================== */

:root {
    /* Brand Colors - PlaneSales */
    --ps-primary: #00144C;
    --ps-primary-hover: #000D33;
    --ps-primary-light: #1a2d5c;
    --ps-secondary: #7DD2F7;
    --ps-secondary-hover: #5BBFE8;
    --ps-secondary-light: #a8e2fa;
    --ps-accent: #7DD2F7;
    --ps-accent-hover: #5BBFE8;

    /* Semantic Colors */
    --ps-success: #198754;
    --ps-success-hover: #146c43;
    --ps-danger: #dc3545;
    --ps-danger-hover: #bb2d3b;
    --ps-warning: #ffc107;
    --ps-warning-hover: #e0a800;
    --ps-info: #7DD2F7;
    --ps-info-hover: #5BBFE8;

    /* Background Colors */
    --ps-background-primary: #f6f9fb;
    --ps-background-secondary: #FFFFFF;
    --ps-surface: #FFFFFF;

    /* Text Colors */
    --ps-text-primary: #00144C;
    --ps-text-secondary: #333333;
    --ps-text-muted: #6c757d;
    --ps-text-light: #FFFFFF;

    /* Button Colors */
    --ps-btn-primary-bg: #00144C;
    --ps-btn-primary-hover: #000D33;
    --ps-btn-primary-text: #FFFFFF;
    --ps-btn-secondary-bg: #7DD2F7;
    --ps-btn-secondary-hover: #5BBFE8;
    --ps-btn-secondary-text: #00144C;

    /* Neutral Colors */
    --ps-light: #f6f9fb;
    --ps-dark: #00144C;
    --ps-gray-100: #f6f9fb;
    --ps-gray-200: #e9ecef;
    --ps-gray-300: #dee2e6;
    --ps-gray-400: #ced4da;
    --ps-gray-500: #adb5bd;
    --ps-gray-600: #6c757d;
    --ps-gray-700: #495057;
    --ps-gray-800: #343a40;
    --ps-gray-900: #00144C;

    /* Typography */
    --ps-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ps-font-size-base: 1rem;
    --ps-line-height-base: 1.5;

    /* Spacing */
    --ps-spacing-xs: 0.25rem;
    --ps-spacing-sm: 0.5rem;
    --ps-spacing-md: 1rem;
    --ps-spacing-lg: 1.5rem;
    --ps-spacing-xl: 3rem;

    /* Borders */
    --ps-border-radius: 0.375rem;
    --ps-border-radius-lg: 0.5rem;
    --ps-border-color: var(--ps-gray-300);

    /* Shadows */
    --ps-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --ps-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --ps-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

    /* Transitions */
    --ps-transition-fast: 150ms ease-in-out;
    --ps-transition-normal: 300ms ease-in-out;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
    font-family: var(--ps-font-family);
    font-size: var(--ps-font-size-base);
    line-height: var(--ps-line-height-base);
}

/* ==========================================================================
   Component: Cards
   ========================================================================== */

.listing-card,
.dealer-card {
    transition: transform var(--ps-transition-fast), box-shadow var(--ps-transition-fast);
}

.listing-card:hover,
.dealer-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ps-shadow);
}

.listing-card .card-img-wrapper img,
.dealer-card .card-img-wrapper img {
    transition: transform var(--ps-transition-normal);
}

.listing-card:hover .card-img-wrapper img,
.dealer-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

/* Featured badge positioning */
.listing-card .badge,
.dealer-card .badge {
    z-index: 1;
}

/* ==========================================================================
   Component: Gallery
   ========================================================================== */

.listing-gallery .main-image-container {
    cursor: pointer;
}

.listing-gallery .thumbnail-container button {
    transition: opacity var(--ps-transition-fast);
}

.listing-gallery .thumbnail-container button:hover {
    opacity: 0.8;
}

/* ==========================================================================
   Component: Search
   ========================================================================== */

.search-box .input-group {
    transition: box-shadow var(--ps-transition-fast);
}

.search-box .input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(0, 20, 76, 0.25);
}

/* ==========================================================================
   Component: Data Grid
   ========================================================================== */

.data-grid th.sortable button {
    color: inherit;
}

.data-grid th.sortable button:hover {
    color: var(--ps-primary);
}

.data-grid tbody tr.cursor-pointer {
    cursor: pointer;
}

.data-grid tbody tr.cursor-pointer:hover {
    background-color: var(--ps-gray-100);
}

/* ==========================================================================
   Component: Side Navigation
   ========================================================================== */

.side-nav {
    min-height: 100vh;
}

.side-nav .nav-link {
    padding: 0.75rem 1rem;
    color: inherit;
    border-radius: var(--ps-border-radius);
    margin: 0.125rem 0.5rem;
}

.side-nav .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.side-nav .nav-link.active {
    background-color: var(--ps-primary);
    color: white;
}

.side-nav.bg-dark .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Collapse chevron rotation */
.side-nav .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.side-nav .bi-chevron-down {
    transition: transform var(--ps-transition-fast);
}

/* ==========================================================================
   Component: Toast Notifications
   ========================================================================== */

.toast-container {
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
}

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

/* ==========================================================================
   Component: Loading Spinner
   ========================================================================== */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
}

/* ==========================================================================
   Component: Pagination
   ========================================================================== */

.pagination .page-link {
    min-width: 2.5rem;
    text-align: center;
}

/* ==========================================================================
   Component: Forms
   ========================================================================== */

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

/* Upload area styling */
.upload-area {
    transition: background-color var(--ps-transition-fast), border-color var(--ps-transition-fast);
}

.upload-area.border-primary {
    background-color: rgba(0, 20, 76, 0.05);
}

/* Dashed border for upload */
.border-dashed {
    border-style: dashed !important;
}

/* ==========================================================================
   Component: Modals
   ========================================================================== */

.modal.show {
    display: block;
}

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

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Cursor utilities */
.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

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

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Aspect ratios */
.aspect-16-9 {
    aspect-ratio: 16 / 9;
}

.aspect-4-3 {
    aspect-ratio: 4 / 3;
}

.aspect-1-1 {
    aspect-ratio: 1 / 1;
}

/* Object fit */
.object-cover {
    object-fit: cover;
}

.object-contain {
    object-fit: contain;
}

/* ==========================================================================
   Component: Image Fallback
   ========================================================================== */

.img-fallback {
    background: url('/_content/PlaneSales.UI.Shared/images/placeholder-aircraft.svg') center / contain no-repeat #f8f9fa;
}

.img-fallback > img,
.img-fallback > .mud-image {
    display: block;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 767.98px) {
    .listing-card .card-img-wrapper,
    .dealer-card .card-img-wrapper {
        height: 180px !important;
    }

    .side-nav {
        min-height: auto;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .no-print,
    .toast-container,
    .modal {
        display: none !important;
    }

    .listing-card,
    .dealer-card {
        break-inside: avoid;
    }
}
