/* =============================================================================
   DETAIL ACTIONS — Tile-based action UI for quote/job/invoice detail pages
   =============================================================================

   Used by templates/components/detail/_action_tile_grid.html.

   Mockup spec: 2x2 grid of square tiles. Icon centered above label, label
   wraps below. One filled "primary" tile, others outlined. All four tiles
   render identically regardless of tile kind (button/link/form/status_menu).
   ============================================================================= */

/* Strip the surrounding .card chrome on the action panel — model shows
   tiles sitting directly on the page, no card border or shadow. */
.action-tile-card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}
.action-tile-card > .card-body { padding-left: 0; padding-right: 0; }

.action-tile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
}

/* Wrapper for <form> and <div class="dropdown"> tile kinds so they
   behave as a grid cell (instead of inline). */
.action-tile-wrap {
    display: block;
    width: 100%;
}

/* The tile itself — must override Bootstrap's `button { display: flex }`
   reboot rule so all variants (button, link, form, dropdown-toggle) render
   identically. */
.action-tile,
.action-tile-grid .action-tile {
    /* Reset for <button> / <a> */
    appearance: none;
    text-decoration: none;
    cursor: pointer;

    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;

    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background: var(--card-bg);
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
    white-space: normal;   /* defeat Bootstrap .dropdown-toggle nowrap */
    word-break: break-word;
    /* Same elevation as the mobile entity-list cards (mobile-cards.css). */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.action-tile:hover {
    border-color: var(--primary-color);
    background: var(--primary-light, rgba(7, 82, 182, 0.06));
    color: var(--text-primary);
}
.action-tile:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.action-tile:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.action-tile__icon {
    font-size: 1.25rem;
    line-height: 1;
}
.action-tile__label {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.15;
}

/* Primary variant — filled */
.action-tile--primary {
    background: var(--primary-color);
    color: var(--text-light);
}
.action-tile--primary:hover {
    background: var(--primary-hover);
    color: var(--text-light);
}

/* Outline variant — explicit */
.action-tile--outline { background: var(--card-bg); color: var(--text-primary); }

/* Disabled (e.g. invoice draft "Awaiting Job") */
.action-tile[disabled],
.action-tile[disabled]:hover {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* Strip dropdown-toggle caret on tiles */
.action-tile.dropdown-toggle::after { display: none; }

/* Cap total grid width on wider viewports so individual tiles don't get
   ridiculously wide on a desktop monitor. */
@media (min-width: 768px) {
    .action-tile-grid { max-width: 36rem; }
}

/* "More" / status-menu dropdowns: large touch targets and a crisp line
   between every item — tradies hit these with big fingers, often gloved. */
.action-tile-grid .dropdown-menu {
    padding: 4px;
    min-width: 13rem;
}

.action-tile-grid .dropdown-menu .dropdown-item {
    padding: 14px 16px;
    font-size: 1rem;
}

/* One divider per gap. Bootstrap wraps each entry in <li>, so `li + li`
   targets every item after the first — whether it's a plain item or a
   <form>-wrapped submit button. Explicit <hr> dividers from the menu
   data are hidden so the borders aren't doubled. */
.action-tile-grid .dropdown-menu li + li > .dropdown-item,
.action-tile-grid .dropdown-menu li + li > form > .dropdown-item {
    border-top: 1px solid #e9ecef;
}

.action-tile-grid .dropdown-menu .dropdown-divider {
    display: none;
}

/* Banner Navigate pill — Google Maps result-card affordance. */
.btn-banner-navigate {
    background: #fff;
    color: #1a73e8;
    border: none;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.btn-banner-navigate:hover,
.btn-banner-navigate:focus {
    background: #f8f9fa;
    color: #1a73e8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.btn-banner-navigate:active {
    background: #e8f0fe;
    color: #1a73e8;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
