/**
 * ============================================
 * EURO-6 Discount System — Custom Styles
 * ============================================
 * Minimal CSS for portal-specific behaviors.
 * Most styling is handled by Tailwind CSS classes.
 * ============================================
 */

/* ============================================
   SAFE AREA INSETS (iPhone notch, etc.)
   ============================================ */

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.pt-safe {
    padding-top: env(safe-area-inset-top, 0px);
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

.portal-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.portal-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.portal-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.portal-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 9999px;
}

.portal-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

/* ============================================
   HTMX LOADING INDICATOR
   ============================================ */

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

@keyframes htmx-progress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   SIDEBAR TRANSITIONS
   ============================================ */

.sidebar-enter {
    transform: translateX(-100%);
}

.sidebar-enter-active {
    transform: translateX(0);
    transition: transform 300ms ease-out;
}

.sidebar-leave-active {
    transform: translateX(-100%);
    transition: transform 200ms ease-in;
}

/* ============================================
   TABLE STYLES
   ============================================ */

/* Sticky table header */
.portal-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
}

/* Row hover effect */
.portal-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Alternating row colors (optional, add class .striped) */
.portal-table.striped tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}

/* ============================================
   LOADING SKELETON
   ============================================ */

.skeleton {
    background: linear-gradient(90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   BADGE PULSE (notification dot)
   ============================================ */

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.badge-pulse {
    animation: badge-pulse 2s ease-in-out infinite;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    /* Hide navigation elements */
    aside,
    header,
    nav[aria-label="Quick navigation"],
    .htmx-indicator,
    button,
    .no-print {
        display: none !important;
    }

    /* Reset layout for print */
    main {
        margin: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    /* Ensure tables break nicely */
    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ============================================
   FORM INPUT FOCUS RING
   ============================================ */

.portal-input {
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.portal-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
    outline: none;
}

/* ============================================
   TOOLTIP (simple CSS-only)
   ============================================ */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
    z-index: 50;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Search highlight */
mark.search-highlight {
    background-color: #fef08a;
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
}
