/* ============================================================
   Photo Timetable - Custom Styles
   Built on top of Bootstrap 5 - mobile-first.
   ============================================================ */

:root {
    --pt-bg:            #f5f6f8;
    --pt-card-bg:       #ffffff;
    --pt-border:        #e3e6ea;
    --pt-muted:         #6c757d;
    --pt-accent:        #0d6efd;
    --pt-accent-soft:   #e7f0ff;
    --pt-done:          #198754;
    --pt-warning:       #ffc107;
    --pt-danger:        #dc3545;
}

html, body { height: 100%; }

body.app-body {
    background: var(--pt-bg);
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
                 Arial, "Noto Sans", sans-serif;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Make container a bit roomier on phones */
.app-main { max-width: 1200px; margin: 0 auto; }

/* ----- Nav ----- */

.app-navbar .navbar-brand { font-weight: 600; letter-spacing: .2px; }
.app-navbar .nav-link.active { color: #fff !important; font-weight: 500; }

/* ----- Cards ----- */

.card {
    border: 1px solid var(--pt-border);
    border-radius: .75rem;
    background: var(--pt-card-bg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--pt-border);
    font-weight: 600;
}

/* ----- Job summary card ----- */

.job-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem 1.25rem;
}
.job-meta-grid .label {
    display: block;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--pt-muted);
    font-weight: 600;
}
.job-meta-grid .value { font-size: .95rem; }

/* ----- Status badges ----- */

.badge.status { font-weight: 500; letter-spacing: .02em; padding: .4em .6em; }

/* ----- Timetable / schedule ----- */

.timetable .schedule-item {
    display: grid;
    grid-template-columns: 84px 1fr auto;
    gap: .75rem;
    align-items: start;
    padding: .85rem .25rem;
    border-bottom: 1px solid var(--pt-border);
}
.timetable .schedule-item:last-child { border-bottom: 0; }
.timetable .time-block {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--pt-accent);
    line-height: 1.2;
}
.timetable .time-block .end { color: var(--pt-muted); font-weight: 500; font-size: .85em; }
.timetable .title-block .title { font-weight: 600; }
.timetable .title-block .meta { font-size: .85rem; color: var(--pt-muted); }
.timetable .title-block .notes { font-size: .9rem; margin-top: .25rem; white-space: pre-wrap; }

/* "Happening now" highlight */
.timetable .schedule-item.is-now {
    background: #111827;
    color: #f9fafb;
    border-radius: .5rem;
    border-bottom-color: transparent;
    margin: .25rem 0;
    padding: .85rem .85rem;
    box-shadow: 0 4px 14px rgba(17, 24, 39, .35);
    position: relative;
}
.timetable .schedule-item.is-now::before {
    content: "";
    position: absolute;
    left: 0; top: 10%; bottom: 10%;
    width: 4px;
    background: #ef4444;
    border-radius: 4px;
    animation: pt-now-pulse 1.6s ease-in-out infinite;
}
@keyframes pt-now-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}
.timetable .schedule-item.is-now .time-block        { color: #f9fafb; }
.timetable .schedule-item.is-now .time-block .end   { color: #cbd5e1; }
.timetable .schedule-item.is-now .title-block .title{ color: #f9fafb; }
.timetable .schedule-item.is-now .title-block .meta { color: #cbd5e1; }
.timetable .schedule-item.is-now .title-block .notes{ color: #e5e7eb; }
.timetable .now-pill { display: none; }
.timetable .schedule-item.is-now .now-pill {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    margin-top: .35rem;
    background: #ef4444;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 8px;
    border-radius: 999px;
}
.timetable .schedule-item.is-now .row-actions .btn-outline-secondary,
.timetable .schedule-item.is-now .row-actions .btn-outline-danger {
    color: #f9fafb;
    border-color: rgba(255, 255, 255, .35);
}
.timetable .schedule-item.is-now .row-actions .btn-outline-secondary:hover { background: rgba(255, 255, 255, .12); }
.timetable .schedule-item.is-now .row-actions .btn-outline-danger:hover    { background: rgba(239, 68, 68, .25); }
@media print {
    .timetable .schedule-item.is-now { background: #fff; color: inherit; box-shadow: none; }
    .timetable .schedule-item.is-now::before { display: none; }
}

@media (max-width: 480px) {
    .timetable .schedule-item {
        grid-template-columns: 70px 1fr;
        grid-template-rows: auto auto;
    }
    .timetable .schedule-item .row-actions {
        grid-column: 1 / -1;
        margin-top: .25rem;
    }
}

/* ----- Shot list ----- */

.shot-list .shot-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .75rem;
    padding: .75rem .25rem;
    border-bottom: 1px solid var(--pt-border);
    align-items: start;
}
.shot-list .shot-item:last-child { border-bottom: 0; }
.shot-list .shot-item.done .shot-name { text-decoration: line-through; color: var(--pt-muted); }
.shot-list .shot-name { font-weight: 600; }
.shot-list .shot-desc { font-size: .9rem; color: #4b5563; white-space: pre-wrap; }
.shot-list .shot-meta { font-size: .8rem; color: var(--pt-muted); margin-top: .15rem; }
.shot-list .shot-toggle input { width: 22px; height: 22px; }
.shot-category-header {
    background: var(--pt-accent-soft);
    color: var(--pt-accent);
    font-weight: 600;
    padding: .4rem .75rem;
    border-radius: .4rem;
    margin: 1rem 0 .5rem;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ----- Gear ----- */

.gear-list .gear-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .75rem;
    padding: .65rem .25rem;
    border-bottom: 1px solid var(--pt-border);
    align-items: center;
}
.gear-list .gear-item:last-child { border-bottom: 0; }
.gear-list .gear-item.packed .gear-name { text-decoration: line-through; color: var(--pt-muted); }
.gear-list input[type=checkbox] { width: 22px; height: 22px; }

/* ----- Contacts ----- */

.contact-card {
    border: 1px solid var(--pt-border);
    border-radius: .5rem;
    padding: .75rem .9rem;
    background: #fff;
    height: 100%;
}
.contact-card .name { font-weight: 600; }
.contact-card .role { font-size: .85rem; color: var(--pt-muted); }
.contact-card a { text-decoration: none; }

.contact-card.is-primary {
    border-color: #ffd166;
    background: #fffbe8;
    box-shadow: 0 0 0 1px #ffd166 inset;
}
.contact-card .primary-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: #f7b500;
    color: #1f2937;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

/* ----- Contact picker ----- */
.contact-picker { position: relative; }
.contact-picker .picker-results {
    position: absolute;
    z-index: 10;
    background: #fff;
    border: 1px solid var(--pt-border);
    border-radius: .5rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .08);
    margin-top: .25rem;
    max-height: 320px;
    overflow-y: auto;
    width: 100%;
}
.contact-picker .picker-result {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: .55rem .8rem;
    display: block;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}
.contact-picker .picker-result:last-child { border-bottom: 0; }
.contact-picker .picker-result:hover,
.contact-picker .picker-result:focus { background: #f1f5ff; }
.contact-picker .result-name { line-height: 1.2; }
.contact-picker .result-meta { line-height: 1.2; margin-top: 2px; }
.contact-picker .picker-empty {
    padding: .6rem .8rem;
    color: var(--pt-muted);
    font-size: .9rem;
}
.contact-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    border-radius: .5rem;
    padding: .55rem .8rem;
}
.contact-chip .chip-name { font-size: 1rem; }
.contact-chip .chip-meta { margin-top: 2px; }
.contact-chip .chip-actions { white-space: nowrap; }

/* ----- Job list rows ----- */

.job-row {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 1rem;
    padding: .9rem .75rem;
    border-bottom: 1px solid var(--pt-border);
    align-items: center;
    background: #fff;
}
.job-row:first-child { border-top-left-radius: .75rem; border-top-right-radius: .75rem; }
.job-row:last-child  { border-bottom: 0;
    border-bottom-left-radius: .75rem; border-bottom-right-radius: .75rem; }
.job-row .date-block {
    text-align: center;
    background: var(--pt-accent-soft);
    color: var(--pt-accent);
    border-radius: .5rem;
    padding: .4rem .25rem;
    font-weight: 600;
    line-height: 1.15;
}
.job-row .date-block .day  { font-size: 1.35rem; }
.job-row .date-block .mon  { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.job-row .title { font-weight: 600; }
.job-row .meta  { font-size: .85rem; color: var(--pt-muted); }
.job-row a.stretched { color: inherit; text-decoration: none; }

@media (max-width: 480px) {
    .job-row { grid-template-columns: 70px 1fr; }
    .job-row .actions { grid-column: 1 / -1; }
}

/* ----- Today's Job hero ----- */

.today-hero {
    background: linear-gradient(135deg, #0d6efd 0%, #084298 100%);
    color: #fff;
    border-radius: .9rem;
    padding: 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 6px 16px rgba(13, 110, 253, .25);
}
.today-hero .eyebrow {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .75rem;
    opacity: .9;
}
.today-hero h2 { margin: .15rem 0 .5rem; font-weight: 600; }
.today-hero .btn-light { color: #0d6efd; font-weight: 600; }

/* ----- Login ----- */

.login-wrap {
    min-height: calc(100vh - 80px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.login-card { max-width: 380px; width: 100%; }

/* ----- Misc ----- */

.empty-state {
    text-align: center;
    color: var(--pt-muted);
    padding: 2rem 1rem;
}
.empty-state i { font-size: 2.25rem; opacity: .5; }

.form-section-title {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pt-muted);
    font-weight: 600;
    margin: 1.25rem 0 .5rem;
}

.app-footer { color: var(--pt-muted); }

/* Form controls: bigger touch targets on mobile */
@media (max-width: 576px) {
    .form-control, .form-select, .btn { font-size: 1rem; }
    .btn { padding: .55rem 1rem; }
}

/* Print-friendly run sheet for use on location */
@media print {
    .app-navbar, .app-footer, .no-print, .btn { display: none !important; }
    body.app-body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ============================================================
   Settings area
   ============================================================ */

.settings-card {
    transition: transform .12s ease, box-shadow .12s ease;
    color: #1f2937;
    border: 1px solid var(--pt-border);
}
.settings-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(13, 110, 253, .12);
    color: #1f2937;
}
.settings-icon {
    width: 44px; height: 44px;
    background: var(--pt-accent-soft);
    color: var(--pt-accent);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: .75rem;
}

/* ---- Job type swatch & pill ---- */

.type-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, .12);
    flex-shrink: 0;
}

.job-type-pill {
    --type-color: #6c757d;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 500;
    color: var(--type-color);
    background: color-mix(in srgb, var(--type-color) 12%, white);
    border: 1px solid color-mix(in srgb, var(--type-color) 28%, white);
    padding: .15rem .5rem;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
}
.job-type-pill .type-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--type-color);
    border-color: var(--type-color);
}

/* Fallback for older browsers that don't support color-mix */
@supports not (background: color-mix(in srgb, red 50%, white)) {
    .job-type-pill {
        background: #f1f3f5;
        border-color: #dee2e6;
    }
}

/* ---- Working hours editor ---- */

.working-day-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--pt-border);
    align-items: start;
}
.working-day-row:last-child { border-bottom: 0; }
.working-day-row .day-name {
    font-weight: 600;
    font-size: 1rem;
}
.working-day-row.is-closed .day-name { color: var(--pt-muted); }
.working-day-row.is-closed .day-slots { opacity: .55; }

.working-day-row .slot-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.working-day-row .slot-row {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
}
.working-day-row .time-start,
.working-day-row .time-end {
    width: 130px;
    flex: 0 0 auto;
}
.working-day-row .remove-slot {
    line-height: 1;
    padding: .25rem .4rem;
}
.working-day-row .add-slot {
    align-self: flex-start;
    padding: .15rem .55rem;
    font-size: .8rem;
}

@media (max-width: 640px) {
    .working-day-row {
        grid-template-columns: 1fr;
        gap: .4rem;
        padding: .9rem 0;
    }
    .working-day-row .day-label {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .working-day-row .day-label .day-name { font-size: 1.05rem; }
    .working-day-row .day-label .form-check { margin-top: 0 !important; }
    .working-day-row .time-start,
    .working-day-row .time-end { width: calc(50% - 36px); }
}

/* ============================================================
   Calendar
   ============================================================ */

.calendar {
    overflow: hidden;
    padding: 0;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8fafc;
    border-bottom: 1px solid var(--pt-border);
}
.calendar-weekdays .weekday {
    text-align: center;
    padding: .55rem .25rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--pt-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(110px, auto);
}

.day-cell {
    border-right: 1px solid var(--pt-border);
    border-bottom: 1px solid var(--pt-border);
    padding: .35rem .35rem .5rem;
    min-height: 110px;
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    transition: background-color .12s ease;
}
.day-cell:nth-child(7n) { border-right: 0; }
.day-cell:nth-last-child(-n+7) { border-bottom: 0; }

.day-cell.is-other        { background: #fafbfc; }
.day-cell.is-other .day-number { color: #c0c5cc; }
.day-cell.is-weekend:not(.is-other) { background: #fbfcfe; }

.day-cell.is-today {
    background: #fff8ed;
    box-shadow: inset 0 0 0 2px var(--pt-accent);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .15rem;
}

.day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
}
.day-number:hover { background: var(--pt-accent-soft); color: var(--pt-accent); }

.day-cell.is-today .day-number {
    background: var(--pt-accent);
    color: #fff;
}
.day-cell.is-today .day-number:hover { background: #0a58ca; color: #fff; }

.day-count {
    font-size: .65rem;
    font-weight: 600;
    background: var(--pt-accent-soft);
    color: var(--pt-accent);
    padding: 0 .35rem;
    border-radius: 999px;
    line-height: 1.4;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.event {
    display: flex;
    align-items: baseline;
    gap: .25rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: .75rem;
    line-height: 1.25;
    text-decoration: none;
    color: #fff;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-left: 3px solid rgba(0, 0, 0, .25);
    transition: transform .08s ease, filter .08s ease;
}
.event:hover {
    color: #fff;
    transform: translateY(-1px);
    filter: brightness(1.06);
}
.event-time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    opacity: .9;
    flex: 0 0 auto;
}
.event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* A few status accents - soft pastel fill with a strong left border,
   reading well on the calendar grid. Overrides Bootstrap bg-* with a
   matching but slightly lighter shade. */
.event.status-enquiry     { background: #6c757d; border-left-color: #4b5159; }
.event.status-booked      { background: #0d6efd; border-left-color: #084298; }
.event.status-in_progress { background: #ffc107; border-left-color: #b58a00; color: #1f2937; }
.event.status-completed   { background: #198754; border-left-color: #0f5132; }
.event.status-cancelled   { background: #dc3545; border-left-color: #842029; }

.event-more {
    display: block;
    font-size: .7rem;
    color: var(--pt-accent);
    text-decoration: none;
    padding: 1px 6px;
    font-weight: 500;
}
.event-more:hover { text-decoration: underline; }

/* Legend / quick status filter */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}
.legend-chip {
    display: inline-block;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    opacity: .85;
    border: 2px solid transparent;
}
.legend-chip.bg-warning { color: #1f2937; }
.legend-chip:hover { opacity: 1; }
.legend-chip.is-active {
    opacity: 1;
    border-color: rgba(13, 17, 23, .35);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .85),
                0 0 0 3px rgba(13, 17, 23, .3);
}

/* Mobile: shrink cells, hide times in events to save space, stack
   event titles vertically. */
@media (max-width: 768px) {
    .calendar-grid { grid-auto-rows: minmax(80px, auto); }
    .day-cell { min-height: 80px; padding: .25rem .25rem .35rem; }
    .event { font-size: .68rem; padding: 2px 4px; gap: .15rem; }
}

@media (max-width: 480px) {
    .calendar-weekdays .weekday { font-size: .65rem; padding: .35rem 0; }
    .calendar-grid { grid-auto-rows: minmax(68px, auto); }
    .day-cell { min-height: 68px; }
    /* Show just a dot per event on very small screens */
    .event {
        height: 6px;
        padding: 0;
        border-radius: 3px;
        border-left-width: 0;
    }
    .event-time, .event-title { display: none; }
    .day-count { display: inline-block; }
    .event-more { font-size: .65rem; padding: 0 4px; }
}
