/**
 * CycleLab Mobile Styles
 * プレビューHTMLから完全トレース
 */

/* ============================================
   モバイル専用スタイル (768px以下)
   ============================================ */
@media (max-width: 767px) {
    /* PC用要素を非表示 */
    .mobile-hide,
    .sidebar,
    .page-header p {
        display: none !important;
    }
    
    /* ページヘッダー簡素化 */
    .page-header {
        padding: 12px 16px;
        margin-bottom: 0;
    }
    
    .page-header h2 {
        font-size: 1.2rem;
    }
    
    /* メインコンテンツ調整 */
    .main-content {
        padding: 0;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
    
    /* ============================================
       ボトムナビゲーション
       ============================================ */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 80px;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        padding-top: 8px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 250;
    }
    
    .bottom-nav-items {
        display: flex;
        justify-content: space-around;
        width: 100%;
    }
    
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        color: var(--text-muted);
        font-size: 0.6rem;
        min-width: 50px;
        padding: 4px;
        border: none;
        background: none;
        cursor: pointer;
        text-decoration: none;
    }
    
    .bottom-nav-item.active {
        color: var(--primary);
    }
    
    .bottom-nav-item .icon {
        font-size: 1.3rem;
        line-height: 1;
    }
    
    .bottom-nav-hidden {
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    /* ============================================
       FAB（フローティングアクションボタン）
       ============================================ */
    .fab {
        position: fixed;
        bottom: calc(96px + env(safe-area-inset-bottom, 0px));
        right: 16px;
        width: 52px;
        height: 52px;
        background: var(--primary-gradient);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 1.5rem;
        box-shadow: 0 4px 12px rgba(217,119,6,0.4);
        z-index: 350;
        border: none;
        cursor: pointer;
    }
    
    /* ============================================
       メインタブ（今日/今後）
       ============================================ */
    .main-tabs {
        display: flex;
        background: var(--bg-section);
        border-radius: 10px;
        padding: 4px;
        margin: 12px;
    }
    
    .main-tab {
        flex: 1;
        padding: 10px;
        background: transparent;
        border: none;
        border-radius: 8px;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-muted);
        cursor: pointer;
    }
    
    .main-tab.active {
        background: var(--bg-card);
        color: var(--text-primary);
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    /* ============================================
       ソースタブ（WEB/LINE）
       ============================================ */
    .source-tabs {
        display: flex;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 0 12px;
    }
    
    .source-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 12px;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
    }
    
    .source-tab.active {
        border-bottom-color: var(--primary);
    }
    
    .source-tab-icon {
        font-size: 1.1rem;
    }
    
    .source-tab-label {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-muted);
    }
    
    .source-tab.active .source-tab-label {
        color: var(--text-primary);
    }
    
    .source-tab-badge {
        background: var(--primary);
        color: #fff;
        font-size: 0.7rem;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 10px;
        min-width: 20px;
        text-align: center;
    }
    
    .source-tab:not(.active) .source-tab-badge {
        background: var(--bg-section);
        color: var(--text-muted);
    }
    
    /* ============================================
       予約カード（ダッシュボード用）
       ============================================ */
    .booking-card {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 14px;
        margin-bottom: 10px;
    }
    
    .booking-card.urgent {
        border-left: 3px solid #f59e0b;
    }
    
    .booking-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }
    
    .booking-card-time {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--primary);
    }
    
    .booking-card-customer {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 6px;
    }
    
    .booking-card-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-bottom: 12px;
    }
    
    .booking-card-actions {
        display: flex;
        gap: 8px;
    }
    
    .action-btn {
        height: 40px;
        padding: 0 16px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--bg-card);
        font-size: 1rem;
        color: var(--text-secondary);
        cursor: pointer;
    }
    
    .action-btn.primary {
        flex: 1;
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    /* ============================================
       モバイルカード（スケジュール/顧客一覧）
       ============================================ */
    .mobile-card-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .mobile-card {
        background: var(--bg-card);
        border-radius: 12px;
        padding: 14px;
        border: 1px solid var(--border);
    }
    
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 8px;
    }
    
    .mobile-card-title {
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--text-primary);
    }
    
    .mobile-card-subtitle {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-top: 2px;
    }
    
    .mobile-card-meta {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 3px 10px;
        font-size: 0.75rem;
    }
    
    .mobile-card-meta dt {
        color: var(--text-muted);
    }
    
    .mobile-card-meta dd {
        color: var(--text-secondary);
    }
    
    /* ============================================
       日付セクションヘッダー（今後タブ用）
       ============================================ */
    .date-section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 4px;
        margin-top: 8px;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
        border-bottom: 1px solid var(--border);
    }
    
    .date-section-header span {
        font-size: 0.75rem;
        font-weight: 400;
        color: var(--text-muted);
    }
    
    /* ============================================
       フルスクリーンモーダル
       ============================================ */
    .modal .modal-content {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
    }
    
    .modal .modal-header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .modal .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
    }
    
    .modal .modal-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        display: flex;
        gap: 10px;
    }
    
    /* モーダルボタン */
    .modal .btn {
        flex: 1;
        height: 48px;
        border-radius: 10px;
        font-weight: 600;
        font-size: 0.9rem;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-phone {
        background: #16a34a !important;
        color: #fff !important;
        border: none !important;
    }
    
    .btn-map {
        background: #2563eb !important;
        color: #fff !important;
        border: none !important;
    }
    
    /* ============================================
       月カレンダー（シフト管理）
       ============================================ */
    .calendar-weekdays {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        background: var(--bg-section);
        padding: 8px 0;
        text-align: center;
        font-size: 0.7rem;
        font-weight: 500;
        color: var(--text-secondary);
    }
    
    .calendar-weekdays .weekend {
        color: var(--text-muted);
    }
    
    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
        padding: 8px;
        background: var(--bg-card);
    }
    
    .calendar-day {
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.8rem;
        font-weight: 500;
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-primary);
    }
    
    .calendar-day.work {
        background: #dcfce7;
        color: #166534;
    }
    
    .calendar-day.off {
        background: #f3f4f6;
        color: #9ca3af;
    }
    
    .calendar-day.today {
        position: relative;
        font-weight: 700;
    }
    
    .calendar-day.today::after {
        content: '';
        position: absolute;
        bottom: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        background: var(--primary);
        border-radius: 50%;
    }
    
    .calendar-day.prev-month,
    .calendar-day.next-month {
        opacity: 0.3;
    }
    
    /* シフトサマリー */
    .shift-summary-card {
        background: var(--bg-section);
        border-radius: 10px;
        padding: 12px;
    }
    
    .shift-summary-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
    }
    
    .shift-summary-label {
        font-size: 0.85rem;
        color: var(--text-secondary);
    }
    
    .shift-summary-value {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    /* ============================================
       日付ナビゲーションバー（シフト編集）
       ============================================ */
    .date-nav-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px;
        background: var(--bg-section);
        border-radius: 12px;
        margin-bottom: 16px;
    }
    
    .date-nav-btn {
        width: 40px;
        height: 40px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--bg-card);
        font-size: 1rem;
        color: var(--text-secondary);
        cursor: pointer;
    }
    
    .date-nav-btn:active {
        background: var(--bg-section);
    }
    
    .date-nav-center {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }
    
    .date-nav-date {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .date-nav-weekday {
        font-size: 0.75rem;
        color: var(--text-muted);
    }
    
    /* シフト編集オプション */
    .shift-option {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        background: var(--bg-section);
        border-radius: 10px;
        border: 2px solid transparent;
        cursor: pointer;
    }
    
    .shift-option.selected {
        border-color: var(--primary);
        background: var(--primary-light);
    }
    
    .shift-option-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .shift-option-icon.work {
        background: #dcfce7;
        color: #166534;
    }
    
    .shift-option-icon.off {
        background: #f3f4f6;
        color: #9ca3af;
    }
    
    .shift-option-label {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--text-primary);
    }
    
    /* ============================================
       修理項目
       ============================================ */
    .repair-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px;
        background: var(--bg-section);
        border-radius: 8px;
        font-size: 0.9rem;
        color: var(--text-primary);
    }
    
    .repair-item-remove {
        width: 24px;
        height: 24px;
        border: none;
        background: rgba(220, 38, 38, 0.1);
        color: #dc2626;
        border-radius: 6px;
        font-size: 1rem;
        cursor: pointer;
    }
    
    /* ============================================
       その他メニューグリッド
       ============================================ */
    .more-menu-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .more-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 16px 8px;
        background: var(--bg-section);
        border-radius: 12px;
        cursor: pointer;
    }
    
    .more-menu-item:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    .more-menu-icon {
        font-size: 1.8rem;
    }
    
    .more-menu-label {
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text-primary);
    }
    
    /* ============================================
       タッチフィードバック
       ============================================ */
    .touchable {
        -webkit-tap-highlight-color: rgba(217, 119, 6, 0.1);
    }
    
    .btn:active,
    .mobile-card:active,
    .booking-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    /* ============================================
       モバイル入力フォーム
       ============================================ */
    .mobile-form-input,
    .modal .form-input,
    .modal .modal-field-input,
    .modal .modal-field-select {
        width: 100%;
        height: 48px;
        padding: 0 14px;
        font-size: 16px; /* iOSズーム防止 */
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--bg-card);
        color: var(--text-primary);
        -webkit-appearance: none;
        appearance: none;
    }
    
    .mobile-form-input:focus,
    .modal .form-input:focus,
    .modal .modal-field-input:focus,
    .modal .modal-field-select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }
    
    /* ============================================
       シフトサマリーカード
       ============================================ */
    .shift-summary-card {
        background: var(--bg-card);
        border-radius: 12px;
        padding: 16px;
        border: 1px solid var(--border);
    }
    
    .shift-summary-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
    }
    
    .shift-summary-row:not(:last-child) {
        border-bottom: 1px solid var(--border);
    }
    
    .shift-summary-label {
        font-size: 0.85rem;
        color: var(--text-secondary);
    }
    
    .shift-summary-value {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
    }
}

/* ============================================
   PC表示時はモバイル専用要素を非表示
   ============================================ */
@media (min-width: 768px) {
    .bottom-nav,
    .fab,
    .mobile-card-list,
    .main-tabs.mobile-only,
    .source-tabs,
    .booking-card,
    .more-menu-grid,
    .mobile-only {
        display: none !important;
    }
}
