/* 空き時間検索ツール */

/* 使用方法 */
.usage-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    background: var(--bg-white);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.usage-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.usage-heading i {
    color: var(--primary-color);
    font-size: 0.85rem;
}

.usage-list {
    margin: 0;
    padding-left: 1.4em;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.usage-list li {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .usage-guide {
        grid-template-columns: 1fr;
    }
}

.main-layout {
    max-width: 640px;
    margin: 0 auto var(--spacing-xl);
}

/* セットアップガイド */
.setup-guide {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--radius-md);
    padding: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.setup-icon {
    font-size: 3rem;
    color: #f9a825;
    margin-bottom: var(--spacing-lg);
}

.setup-guide h2 {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

.setup-guide p {
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.7;
}

.setup-guide code {
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.setup-steps {
    text-align: left;
    max-width: 520px;
    margin: 0 auto;
    color: var(--text-tertiary);
    line-height: 1.8;
}

.setup-steps a {
    color: var(--primary-color);
    text-decoration: none;
}

.setup-steps a:hover {
    text-decoration: underline;
}

/* 認証セクション */
.auth-section {
    background: var(--bg-white);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-xl);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.auth-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-lighter);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.auth-icon.connected {
    background: #e8f5e9;
    color: #43a047;
}

.auth-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.auth-desc {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-auth {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-auth:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-auth.btn-logout {
    color: #e53e3e;
    border-color: #feb2b2;
}

.btn-auth.btn-logout:hover {
    background: #fff5f5;
    border-color: #e53e3e;
}

/* フォームセクション */
.form-section {
    background: var(--bg-white);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-md);
    padding: var(--spacing-2xl);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

.section-title i {
    color: var(--primary-color);
}

.form-group {
    margin-bottom: var(--spacing-xl);
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.form-label i {
    color: var(--primary-color);
    font-size: 0.8rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

input[type="date"].form-input {
    cursor: pointer;
}

select.form-input {
    appearance: auto;
    cursor: pointer;
}

/* カレンダー選択チェックボックス */
.calendar-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    max-height: 220px;
    overflow-y: auto;
}

.calendar-checkbox-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: var(--spacing-sm);
    margin: 0;
}

.calendar-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

.calendar-checkbox-item:hover {
    background: var(--bg-light);
}

.calendar-checkbox-item input[type="checkbox"] {
    flex-shrink: 0;
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
}

.calendar-color-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 曜日・祝日フィルター */
.weekday-checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.weekday-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.weekday-checkbox-item:has(input:checked) {
    background: var(--primary-lighter);
    border-color: var(--primary-color);
    color: var(--primary-hover);
    font-weight: 600;
}

.weekday-checkbox-item input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 15px;
    height: 15px;
}

.weekday-checkbox-item--sat:has(input:checked) {
    background: #e3f2fd;
    border-color: #64b5f6;
    color: #1565c0;
}

.weekday-checkbox-item--sun:has(input:checked),
.weekday-checkbox-item--holiday:has(input:checked) {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

/* 日付・時間の範囲入力 */
.range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-row .form-input {
    flex: 1;
}

.time-sep {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* 送信ボタン */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-submit:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-submit:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-submit.loading {
    pointer-events: none;
    opacity: 0.8;
}

/* 検索結果（カレンダー形式） */
.calendar-section {
    background: var(--bg-white);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
}

.results-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
    padding: var(--spacing-xl) 0;
}

.calendar-grid-wrapper {
    overflow-x: auto;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 1px;
    background: var(--border-lighter);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.calendar-weekday-header {
    background: var(--bg-lighter);
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    padding: 8px 4px;
}

.calendar-cell {
    background: var(--bg-white);
    min-height: 110px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-cell.empty {
    background: var(--bg-lighter);
}

.calendar-cell.excluded {
    background: var(--bg-lighter);
}

.calendar-cell.holiday .calendar-cell-date {
    color: #c62828;
}

.calendar-cell-date {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.calendar-cell-holiday-name {
    font-size: 0.68rem;
    color: #c62828;
    line-height: 1.3;
}

.calendar-cell-none {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.calendar-cell-slots {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.free-slot-chip {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-hover);
    background: var(--primary-lighter);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.free-slot-chip:hover {
    border-color: var(--primary-color);
}

.free-slot-chip.selected {
    background: var(--primary-color);
    color: #fff;
}

.calendar-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: -8px 0 var(--spacing-lg);
}

/* 抽出した日付 */
.extracted-section {
    background: var(--bg-white);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

.extracted-output {
    background: var(--bg-lighter);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    padding: var(--spacing-lg);
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
    min-height: 1.6em;
}

.extracted-output.placeholder {
    color: var(--text-muted);
}

.extracted-actions {
    display: flex;
    gap: var(--spacing-md);
}

.extracted-actions .btn-submit {
    flex: 1;
}

.btn-clear-dates {
    background: var(--bg-white);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-clear-dates:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--text-muted);
}

.btn-clear-dates:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* トースト */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    white-space: nowrap;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.copy-toast.success { background: #43a047; }
.copy-toast.error   { background: #e53e3e; }

/* レスポンシブ */
@media (max-width: 768px) {
    .auth-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-auth {
        width: 100%;
        justify-content: center;
    }

    .range-row {
        flex-direction: column;
        align-items: stretch;
    }
}
