/* ══════════════════════════════════════
   農業工程管理 — 共通スタイル
   ══════════════════════════════════════ */

/* ── Base ── */
body { font-family: 'Noto Sans JP', sans-serif; }
.v-application { font-family: 'Noto Sans JP', sans-serif !important; }

/* ── Task status indicators ── */
.task-overdue { border-left: 4px solid #ef4444 !important; }
.task-today   { border-left: 4px solid #f59e0b !important; }
.task-future  { border-left: 4px solid #10b981 !important; }
.task-done    { opacity: 0.6; }

/* ── Image preview ── */
.log-thumbnail {
    width: 36px; height: 36px;
    object-fit: cover; border-radius: 6px;
    cursor: pointer; border: 1px solid #e0e0e0;
}
.preview-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-item { position: relative; display: inline-block; }
.preview-item img {
    width: 80px; height: 80px;
    object-fit: cover; border-radius: 8px;
    border: 1px solid #e0e0e0;
}
.preview-item .remove-btn { position: absolute; top: -6px; right: -6px; }

/* ── Calendar container ── */
.cal-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.cal-container .fc { min-width: 900px; }

/* ── Calendar events ── */
.cal-container .fc-event,
.tasks-calendar-container .fc-event {
    border: none !important;
    margin-bottom: 2px;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
}
.cal-container .fc-event.event-fade-edges,
.tasks-calendar-container .fc-event.event-fade-edges {
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,1) 60%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,1) 60%, transparent 100%);
}

/* ── Calendar resource area ── */
.cal-container .fc .fc-resource-timeline-divider,
.tasks-calendar-container .fc .fc-resource-timeline-divider { width: 2px; }
.cal-container .fc-resource-group .fc-datagrid-cell-frame,
.tasks-calendar-container .fc-resource-group .fc-datagrid-cell-frame { font-weight: bold; }

/* ── Calendar done state ── */
.cal-event-done { opacity: 0.35 !important; filter: grayscale(80%); }

/* ── Weekend / holiday column colors ── */
.fc-slot-saturday .fc-timeline-slot-frame,
.fc-slot-saturday .fc-timeline-lane-frame { background-color: rgba(33, 150, 243, 0.08) !important; }
.fc-label-saturday { color: #1976D2 !important; }

.fc-slot-sunday .fc-timeline-slot-frame,
.fc-slot-sunday .fc-timeline-lane-frame { background-color: rgba(244, 67, 54, 0.08) !important; }
.fc-label-sunday { color: #D32F2F !important; }

.fc-slot-holiday .fc-timeline-slot-frame,
.fc-slot-holiday .fc-timeline-lane-frame { background-color: rgba(244, 67, 54, 0.08) !important; }
.fc-label-holiday { color: #D32F2F !important; }

/* ── Sticky header for data tables ── */
.fixed-header thead th {
    position: sticky;
    top: 0;
    background-color: #f5f5f5 !important;
    z-index: 2;
}

/* ── Datagrid dot hide ── */
.cal-container .fc-daygrid-event-dot,
.tasks-calendar-container .fc-daygrid-event-dot { display: none; }

/* ══════════════════════════════════════
   MOBILE RESPONSIVE STYLES
   ══════════════════════════════════════ */

/* ── Bottom Navigation (mobile only) ── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
}
.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    cursor: pointer;
    color: #757575;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.mobile-bottom-nav .nav-item.active {
    color: #2E7D32;
}
.mobile-bottom-nav .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 3px;
    background: #2E7D32;
    border-radius: 0 0 4px 4px;
}
.mobile-bottom-nav .nav-item .mdi {
    font-size: 22px;
    margin-bottom: 2px;
}

/* ── Mobile Task Card ── */
.mobile-task-card {
    display: none;
}
.mobile-task-card .task-card-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    -webkit-tap-highlight-color: transparent;
}
.mobile-task-card .task-card-item:last-child {
    border-bottom: none;
}
.mobile-task-card .task-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.mobile-task-card .task-card-body {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mobile-task-card .task-crop {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2E7D32;
}
.mobile-task-card .task-variety {
    font-size: 0.75rem;
    color: #9e9e9e;
}
.mobile-task-card .task-field {
    font-size: 0.8rem;
    color: #616161;
}
.mobile-task-card .task-work {
    font-weight: 600;
    font-size: 0.85rem;
    color: #212121;
}
.mobile-task-card .task-work-detail {
    font-size: 0.7rem;
    color: #9e9e9e;
}
.mobile-task-card .task-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* ── Mobile Log Card ── */
.mobile-log-card .log-card-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
}
.mobile-log-card .log-card-item:last-child { border-bottom: none; }
.mobile-log-card .log-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.mobile-log-card .log-card-body {
    font-size: 0.85rem;
    color: #424242;
}

/* ── FAB (Floating Action Button) ── */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 76px; /* above bottom nav */
    right: 16px;
    z-index: 99;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #2E7D32;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}
.mobile-fab:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.mobile-fab .mdi { font-size: 28px; }

/* ── Mobile Media Queries ── */
@media (max-width: 600px) {
    /* Show mobile elements */
    .mobile-bottom-nav { display: block; }
    .mobile-fab { display: flex; }
    .mobile-task-card { display: block; }

    /* Hide desktop elements */
    .desktop-tabs { display: none !important; }
    .desktop-table { display: none !important; }

    /* App bar compact */
    .v-app-bar .v-toolbar__content { min-height: 48px !important; }
    .v-app-bar .v-toolbar-title { font-size: 1rem !important; }

    /* Main content padding for bottom nav */
    .v-main { padding-bottom: 60px !important; }
    .v-container { padding: 8px !important; }

    /* Task filter compact */
    .task-filter-bar { padding: 8px !important; }
    .task-filter-bar .v-select { max-width: 100% !important; min-width: unset !important; }
    .task-filter-bar .d-flex { flex-direction: column; gap: 6px !important; }
    .task-filter-bar .v-chip-group { width: 100%; }

    /* Log filter compact */
    .log-filter-bar .d-flex { flex-direction: column; gap: 6px !important; }
    .log-filter-bar .v-text-field,
    .log-filter-bar .v-select { max-width: 100% !important; }

    /* Dialog full-screen on mobile */
    .v-dialog--fullscreen .v-card { border-radius: 0 !important; }
    .mobile-fullscreen .v-overlay__content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 100% !important;
        height: 100% !important;
        margin: 0 !important;
    }
    .mobile-fullscreen .v-card {
        border-radius: 0 !important;
        min-height: 100vh;
        min-height: 100dvh;
    }

    /* Time slot row — 2 columns not 3 */
    .time-row-mobile .v-col { flex: 0 0 50% !important; max-width: 50% !important; }
    .time-row-mobile .break-col-mobile { flex: 0 0 100% !important; max-width: 100% !important; }

    /* Calendar mobile adjustments */
    .cal-container .fc { min-width: 600px; }
    .cal-container .fc .fc-datagrid-cell { font-size: 0.75rem; }

    /* Sub tabs compact */
    .v-tabs--density-compact .v-btn { min-width: unset !important; padding: 0 10px !important; }

    /* Chip group scrollable */
    .v-chip-group { flex-wrap: nowrap !important; overflow-x: auto; }

    /* Data table items-per-page hide */
    .v-data-table-footer__items-per-page { display: none !important; }

    /* Calendar detail dialog mobile */
    .cal-detail-mobile .v-overlay__content {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }

    /* Snackbar above bottom nav */
    .v-snackbar { bottom: 64px !important; }
}

/* Medium screens (tablet) */
@media (min-width: 601px) and (max-width: 960px) {
    .task-filter-bar .v-select { max-width: 140px !important; }
    .cal-container .fc { min-width: 700px; }
}
