/* Rent a Machine, brand theme layered on top of the Bootstrap 5 CDN bundle */

:root {
    --ph-primary: #4338ca;
    --ph-primary-dark: #3730a3;
    --ph-primary-rgb: 67, 56, 202;
    --ph-dark: #111827;
    --ph-bg: #f9fafb;
    --ph-border: #e5e7eb;
    --ph-muted: #6b7280;

    /* Feed our palette into the Bootstrap variables templates already use
       (bg-primary/btn-primary/badges etc.) so no template changes are needed. */
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bs-body-bg: var(--ph-bg);
    --bs-body-color: var(--ph-dark);
    --bs-link-color: var(--ph-primary);
    --bs-link-hover-color: var(--ph-primary-dark);
    --bs-primary: var(--ph-primary);
    --bs-primary-rgb: var(--ph-primary-rgb);
    --bs-border-radius: 0.5rem;
}

body {
    font-family: var(--bs-body-font-family);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--ph-dark);
}

a {
    color: var(--bs-link-color);
}

/* Navbar */
.navbar.bg-dark {
    background-color: var(--ph-dark) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.navbar-dark .nav-link {
    transition: color 0.15s ease-in-out;
}

.navbar-dark .nav-link:hover {
    color: #fff;
}

/* The logout control is a <button> inside a <form> so it POSTs (Django 5 requires
   POST for logout), reset native button chrome so it lines up exactly like the
   sibling <a class="nav-link"> items instead of showing as a browser-styled button. */
.navbar-nav button.nav-link {
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}

/* Buttons */
.btn-primary {
    --bs-btn-bg: var(--ph-primary);
    --bs-btn-border-color: var(--ph-primary);
    --bs-btn-hover-bg: var(--ph-primary-dark);
    --bs-btn-hover-border-color: var(--ph-primary-dark);
    --bs-btn-active-bg: var(--ph-primary-dark);
    --bs-btn-active-border-color: var(--ph-primary-dark);
    --bs-btn-disabled-bg: var(--ph-primary);
    --bs-btn-disabled-border-color: var(--ph-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--ph-primary);
    --bs-btn-border-color: var(--ph-primary);
    --bs-btn-hover-bg: var(--ph-primary);
    --bs-btn-hover-border-color: var(--ph-primary);
    --bs-btn-active-bg: var(--ph-primary-dark);
    --bs-btn-active-border-color: var(--ph-primary-dark);
}

/* Cards */
.card {
    border: 1px solid var(--ph-border);
    border-radius: 0.5rem;
    box-shadow: none;
}

.card a {
    text-decoration: none;
}

/* Category browse tiles on the home page */
.category-tile {
    border: 1px solid var(--ph-border);
    border-radius: 0.5rem;
    background-color: #fff;
    color: var(--ph-dark);
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.category-tile:hover {
    border-color: var(--ph-primary);
    color: var(--ph-primary);
}

/* Dashboard cards */
.dashboard-card {
    border: 1px solid var(--ph-border);
    box-shadow: none;
}

.stat-card {
    border: 1px solid var(--ph-border);
    box-shadow: none;
}

.stat-card .display-6 {
    font-weight: 700;
    color: var(--ph-primary);
}

/* Machine listing thumbnails, flat placeholder until a real photo is uploaded */
.machine-thumb {
    aspect-ratio: 4 / 3;
    width: 100%;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--ph-border);
}

.machine-thumb-placeholder {
    background-color: #e5e7eb;
    color: #9ca3af;
}

/* Machine listing rows, stacked, image-left layout (alternative to the grid) */
.list-item {
    border: 1px solid var(--ph-border);
    border-radius: 0.5rem;
    background-color: #fff;
    overflow: hidden;
}

.list-item-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.list-item-body {
    padding: 1rem 1.25rem;
}

.list-item-price {
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .list-item-thumb {
        width: 220px;
        height: auto;
        flex-shrink: 0;
    }
}

/* Small thumbnail used in the owner's machine management table */
.machine-row-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 0.25rem;
}

/* Machine detail page hero photo, fixed height (not max-height) so the
   pane doesn't resize as you click through photos with different aspect
   ratios; object-fit crops each one to fill the same box instead. */
.machine-detail-photo {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

/* Add/Edit Machine "Photos" section, a clickable tile in the same grid as
   existing photo thumbnails, rather than a separate, easy-to-miss plain file
   input further down the page (real bug report: a company couldn't find how
   to add photos while editing, since the only working control was visually
   disconnected from the photos they were looking at). */
.photo-add-tile {
    width: 72px;
    height: 54px;
    border: 2px dashed var(--ph-border);
    cursor: pointer;
}

.photo-add-tile:hover {
    border-color: var(--ph-primary);
    color: var(--ph-primary) !important;
}

.machine-gallery-main {
    position: relative;
}

.machine-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.machine-gallery-nav:hover {
    background: rgba(0, 0, 0, 0.75);
}

.machine-gallery-nav-prev {
    left: 12px;
}

.machine-gallery-nav-next {
    right: 12px;
}

/* Thumbnail strip below the hero photo, for listings with more than one image */
.machine-gallery-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 0.25rem;
    cursor: pointer;
    opacity: 0.7;
    border: 2px solid transparent;
}

.machine-gallery-thumb:hover {
    opacity: 1;
}

.machine-gallery-thumb.active {
    opacity: 1;
    border-color: var(--ph-primary);
}

.detail-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ph-dark);
    margin-bottom: 0.25rem;
}

/* Pricing page "You're currently on X. Status: Y." summary, a little
   colour so the plan name and status stand out against the surrounding
   muted sentence, without turning it into an alert banner. */
.text-plan-name {
    color: var(--ph-primary);
}

.text-subscription-status-active {
    color: #15803d;
}

.text-subscription-status-trial {
    color: var(--ph-primary);
}

.text-subscription-status-expired {
    color: #b45309;
}

.text-subscription-status-cancelled {
    color: var(--ph-muted);
}

/* Month-grid availability calendar */
.availability-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.availability-grid-header {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--ph-muted);
    text-transform: uppercase;
}

.availability-day,
.availability-day-blank {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: #fff;
}

.availability-day.available {
    background-color: #ecfdf5;
    color: #059669;
    cursor: pointer;
}

.availability-day.available:hover {
    background-color: #d1fae5;
}

.availability-day.booked {
    background-color: #fef2f2;
    color: #dc2626;
    cursor: not-allowed;
}

.availability-day.past {
    background-color: var(--ph-bg);
    color: var(--ph-border);
    cursor: not-allowed;
}

.availability-day.today {
    box-shadow: inset 0 0 0 2px var(--ph-primary);
}

.availability-day.selected {
    outline: 2px solid var(--ph-dark);
    outline-offset: 1px;
}

/* Compact variant used next to the main photo on the detail page */
.availability-grid-compact .availability-day,
.availability-grid-compact .availability-day-blank {
    font-size: 0.65rem;
}

/* Prev/next month buttons, plain <button> elements so month navigation
   doesn't submit/reload the page; reset native button chrome to match the
   look of a simple text arrow. */
.calendar-nav {
    background: none;
    border: none;
    font: inherit;
    color: var(--ph-primary);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
}

.calendar-nav:hover {
    color: var(--ph-primary-dark);
}

.calendar-nav:disabled,
.calendar-nav.calendar-nav-disabled {
    color: var(--ph-border);
    cursor: not-allowed;
}

.legend-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 0.2rem;
    vertical-align: middle;
}

.legend-swatch.available {
    background-color: #059669;
}

.legend-swatch.booked {
    background-color: #dc2626;
}

.legend-swatch.past {
    background-color: var(--ph-border);
}

/* Subscription status badges: trial=blue, active=green, expired=red */
.badge.bg-primary {
    background-color: #2563eb !important;
}

.badge.bg-success {
    background-color: #059669 !important;
}

.badge.bg-danger {
    background-color: #dc2626 !important;
}

/* Inquiry status badges */
.status-badge.status-new {
    background-color: #0891b2;
}

.status-badge.status-viewed {
    background-color: #6b7280;
}

.status-badge.status-contacted {
    background-color: #2563eb;
}

.status-badge.status-booked {
    background-color: #059669;
}

.status-badge.status-lost,
.status-badge.status-cancelled {
    background-color: #dc2626;
}

/* Responsive table styling */
.table-responsive .table {
    margin-bottom: 0;
}

.table-responsive th {
    white-space: nowrap;
    color: var(--ph-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

/* Form improvements */
.form-control:focus {
    border-color: var(--ph-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--ph-primary-rgb), 0.15);
}

label.form-label {
    font-weight: 500;
}

/* Hide number input spinner arrows for a cleaner look (price filters, price-per-day field) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Footer */
footer.bg-dark {
    background-color: var(--ph-dark) !important;
}

/* Pricing page */
.pricing-card {
    position: relative;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.pricing-card-recommended {
    border-color: var(--ph-primary);
    box-shadow: 0 0.5rem 1.5rem rgba(var(--ph-primary-rgb), 0.12);
}

.pricing-card-ribbon {
    position: absolute;
    top: -0.65rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--ph-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    white-space: nowrap;
}

.pricing-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ph-dark);
    font-variant-numeric: tabular-nums;
}

.pricing-feature-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.4rem;
    color: var(--ph-dark);
}

.pricing-feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--ph-primary);
    font-weight: 700;
}

/* Footer tagline, deliberately faded relative to the nav links and
   copyright around it, so it reads as a quiet footnote rather than a
   second headline competing with the rest of the footer. */
.footer-tagline {
    opacity: 0.65;
}

.footer-tagline-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.35);
}

.footer-tagline-link:hover {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, 0.7);
}
