/* Paradise FMX - Senior-friendly styles */

:root {
    --bs-body-font-size: 1rem; /* 16px base */
    --bs-primary: #ed1c24;
    --bs-primary-rgb: 237, 28, 36;
}

body {
    font-size: 1rem;
    line-height: 1.6;
}

/* Large clickable areas */
.btn {
    min-height: 44px;
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
}

.btn-lg {
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 1.0625rem;
}

/* Form controls */
.form-control,
.form-select {
    min-height: 44px;
    font-size: 1rem;
    padding: 0.5rem 0.875rem;
}

.form-control-lg,
.form-select-lg {
    min-height: 48px;
    font-size: 1.0625rem;
}

.form-label {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

/* High contrast focus states */
.btn:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.5);
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Links */
a {
    text-decoration: underline;
}

.nav-link,
.navbar-brand,
.btn {
    text-decoration: none;
}

/* Cards with good spacing */
.card {
    margin-bottom: 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.table th,
.table td {
    padding: 1rem;
    vertical-align: middle;
}

/* Badges */
.badge {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: nowrap;
}

/* Status colors — filled, high contrast */
.badge-new {
    background-color: #dbeafe;
    color: #1e40af;
    border: none;
}

.badge-triaged {
    background-color: #ede9fe;
    color: #5b21b6;
    border: none;
}

.badge-in_progress {
    background-color: #ffedd5;
    color: #9a3412;
    border: none;
}

.badge-waiting {
    background-color: #f3f4f6;
    color: #374151;
    border: none;
}

.badge-completed {
    background-color: #dcfce7;
    color: #166534;
    border: none;
}

.badge-closed {
    background-color: #e5e7eb;
    color: #1f2937;
    border: none;
}

/* Asset status colors — tinted backgrounds */
.badge-operational {
    background-color: #dcfce7;
    color: #166534;
    border: none;
}

.badge-attention {
    background-color: #ffedd5;
    color: #9a3412;
    border: none;
}

.badge-out_of_service {
    background-color: #fee2e2;
    color: #991b1b;
    border: none;
}

.badge-disposed {
    background-color: #f3f4f6;
    color: #374151;
    border: none;
}

/* Quote status colors — tinted backgrounds */
.badge-quote-none {
    background-color: #f3f4f6;
    color: #374151;
    border: none;
}

.badge-quote-requested {
    background-color: #e0f2fe;
    color: #075985;
    border: none;
}

.badge-quote-received {
    background-color: #ffedd5;
    color: #9a3412;
    border: none;
}

.badge-quote-approved {
    background-color: #dcfce7;
    color: #166534;
    border: none;
}

/* Priority colors — tinted backgrounds */
.badge-low {
    background-color: #f3f4f6;
    color: #374151;
    border: none;
}

.badge-normal {
    background-color: #e0f2fe;
    color: #075985;
    border: none;
}

.badge-high {
    background-color: #ffedd5;
    color: #9a3412;
    border: none;
}

.badge-urgent {
    background-color: #fee2e2;
    color: #991b1b;
    border: none;
    font-weight: 700;
}

/* Tag colors — filled pills */
.badge-tag-red { background-color: #fee2e2; color: #991b1b; }
.badge-tag-orange { background-color: #ffedd5; color: #9a3412; }
.badge-tag-yellow { background-color: #fef9c3; color: #854d0e; }
.badge-tag-green { background-color: #dcfce7; color: #166534; }
.badge-tag-blue { background-color: #dbeafe; color: #1e40af; }
.badge-tag-purple { background-color: #ede9fe; color: #5b21b6; }
.badge-tag-gray { background-color: #f3f4f6; color: #374151; }
.badge-tag-teal { background-color: #ccfbf1; color: #115e59; }

/* Notification count */
.notification-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background-color: #dc3545;
    border-radius: 10px;
}

/* Overdue highlight */
.overdue {
    border-left: 4px solid #dc3545;
}

.urgent {
    border-left: 4px solid #dc3545;
    background-color: #fff5f5;
}

/* Big action buttons on home */
.action-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.action-card .bi {
    font-size: 3rem;
}

/* Timeline / Work log */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dee2e6;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-2rem + 0.5rem + 1px - 6px);
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--bs-primary);
    border: 2px solid #fff;
}

.timeline-item.status-change::before {
    background-color: #198754;
}

.timeline-item.assignment::before {
    background-color: #6f42c1;
}

/* Print styles */
@page { size: portrait; margin: 10mm; }
@media print {
    /* Hide everything non-essential */
    .navbar, .btn, footer, .no-print, .mobile-action-bar,
    .editable-field small, #title-edit, #description-edit,
    #resolution-edit, .reaction-toggle, .request-card-subscribe,
    #bijlagen, .card-footer, hr { display: none !important; }

    * { box-shadow: none !important; }

    body {
        font: 8pt/1.2 "PT Sans", Arial, sans-serif;
        color: #000 !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0;
    }

    .container { max-width: 100%; padding: 0; }
    main.container { padding: 0 !important; }
    a { text-decoration: none; color: inherit !important; }

    /* Single column */
    .row { margin: 0 !important; }
    .col-lg-8, .col-lg-4,
    .col-sm-4, .col-sm-8 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }

    /* Cards — invisible wrapper */
    .card { border: none !important; background: none !important; margin-bottom: 2pt !important; }
    .card-header { background: none !important; border: none !important; padding: 2pt 0 !important; }
    .card-body { padding: 0 !important; }

    /* Headings */
    h1, .h1, .h3 { font-size: 11pt !important; margin: 0 0 2pt !important; }
    h2, .h2, .h4 { font-size: 9pt !important; margin: 4pt 0 1pt !important; }
    h1, h2, h3, h4, h5, h6, .card-title { color: #000 !important; }

    /* Badges — inline text */
    .badge {
        border: none !important;
        color: #000 !important;
        background: #ddd !important;
        font-size: 7pt !important;
        padding: 0 3px !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Description list — tight inline */
    dl.row { margin: 0 !important; font-size: 8pt; }
    dl.row > dt { margin: 0; padding: 0; }
    dl.row > dd { margin: 0 0 1pt; padding: 0; }

    /* Timeline — minimal */
    .timeline { padding-left: 0 !important; }
    .timeline::before { display: none !important; }
    .timeline-item::before { display: none !important; }
    .timeline-item {
        padding: 0 0 3pt !important;
        border-bottom: 0.5pt solid #ddd;
        margin-bottom: 2pt;
        font-size: 7.5pt;
    }
    .timeline-item:last-child { border-bottom: none; }
    .timeline-item p { margin: 0 !important; }

    /* Kill all spacing */
    .mb-4, .mb-3, .mb-2 { margin-bottom: 2pt !important; }
    .py-4, .py-3, .py-2 { padding-top: 1pt !important; padding-bottom: 1pt !important; }
    .text-muted { color: #444 !important; }
    .fs-5, .fs-6, small { font-size: 7.5pt !important; }
}

/* Accessibility */
.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--bs-primary);
    color: #fff;
    padding: 8px;
    z-index: 100;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state .bi {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Responsive tables */
@media (max-width: 768px) {
    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
    }

    .table-responsive-stack td {
        display: block;
        text-align: right;
        padding: 0.75rem;
        border: none;
        border-bottom: 1px solid #dee2e6;
    }

    .table-responsive-stack td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
    }

    .table-responsive-stack td:last-child {
        border-bottom: none;
    }

    .table-responsive-stack thead {
        display: none;
    }
}

/* Mobile optimizations */
@media (max-width: 576px) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: 0.75rem 1rem;
    }

    .btn-lg {
        min-height: 48px;
    }

    /* Better spacing */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Navbar improvements */
    .navbar-brand {
        font-size: 1.1rem;
    }

    .nav-link {
        padding: 0.75rem 0;
        font-size: 1.125rem;
    }

    /* Action cards full width */
    .action-card .bi {
        font-size: 2.5rem;
    }

    .action-card .card-body {
        padding: 1.5rem 1rem;
    }

    /* Form improvements */
    .form-control-lg,
    .form-select-lg {
        font-size: 1rem;
    }

    /* List items more tappable */
    .list-group-item {
        padding: 1rem;
    }

    /* Timeline on mobile */
    .timeline {
        padding-left: 1.5rem;
    }

    /* Hide some table columns on mobile */
    .table .d-none-mobile {
        display: none;
    }

    /* Dashboard filter dropdowns: remove fixed min-width */
    .form-select-sm {
        min-width: 0 !important;
    }

    /* Description list: stack labels above values */
    dl.row > dt,
    dl.row > dd {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        padding-left: 0;
    }
    dl.row > dt {
        margin-bottom: 0;
        padding-bottom: 0;
    }
    dl.row > dd {
        margin-bottom: 0.75rem;
    }

    /* Button groups wrap */
    .btn-group-mobile {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .btn-group-mobile .btn {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* Tablet optimizations */
@media (min-width: 577px) and (max-width: 991px) {
    .container {
        max-width: 100%;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    /* Two-column layout for action cards */
    .action-card .bi {
        font-size: 2.5rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .action-card:hover {
        transform: none;
        box-shadow: none;
    }

    /* Larger tap targets */
    .dropdown-item {
        padding: 0.75rem 1.5rem;
    }

    /* Better select styling */
    select.form-select {
        background-size: 24px;
    }
}

/* Bottom action bar for mobile */
.mobile-action-bar {
    display: none;
}

@media (max-width: 576px) {
    .mobile-action-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 2px solid #dee2e6;
        padding: 0.5rem;
        z-index: 1050;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        gap: 0.5rem;
    }

    .mobile-action-bar .btn {
        flex: 1;
        padding: 0.875rem 0.5rem;
        font-size: 0.9rem;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        border-radius: 0.5rem;
    }

    .mobile-action-bar .btn i {
        font-size: 1.25rem;
    }

    .mobile-action-bar .btn-primary {
        background: linear-gradient(135deg, #ed1c24 0%, #c8102e 100%);
        border: none;
    }

    /* Add padding to body to account for fixed bar */
    body.has-mobile-bar {
        padding-bottom: 90px;
    }

    /* Hide footer on mobile when action bar is present */
    footer {
        display: none;
    }
}

/* Swipe-friendly list items */
.list-group-item-action {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

/* Better file input on mobile */
input[type="file"] {
    cursor: pointer;
}

@media (max-width: 576px) {
    input[type="file"] {
        font-size: 0.9rem;
    }
}

/* Asset grid cards */
.asset-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #dee2e6;
}

.asset-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #ed1c24;
}

.asset-card .card-title {
    font-weight: 600;
}

/* Reaction toggle — minimal inline thumb */
.reaction-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1;
    outline: none;
    box-shadow: none;
}
.reaction-toggle:focus,
.reaction-toggle:focus-visible {
    outline: none;
    box-shadow: none;
}
.reaction-toggle:hover {
    color: #495057;
}
.reaction-toggle.reacted {
    color: var(--paradise-red, #ed1c24);
}
.reaction-toggle small {
    font-weight: 600;
    margin-left: 2px;
}

/* htmx save indicator */
.htmx-save-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #198754;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    animation: htmx-fade 1.2s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}
@keyframes htmx-fade {
    0% { opacity: 0; transform: scale(0.5); }
    15% { opacity: 1; transform: scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; }
}
